Files
greptimedb/tests/cases/standalone/common/order/order_by.sql
LFC 314f2704d4 build(deps): update datafusion to latest and arrow to 51.0 (#3661)
* chore: update datafusion

* update sqlness case of time.sql

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: adjust range query partition

* fix: hisogram incorrect result

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: ignore filter pushdown temporarily

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: update limit sqlness result

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: histogram with wrong distribution

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: update negative ordinal sqlness case

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* feat: bump df to cd7a00b

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* resolve conflicts

* ignore test_range_filter

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix promql exec panic

* fix "select count(*)" exec error

* re-enable the "test_range_filter" test since the filter push down seems not necessary to be removed

* fix: range query schema error

* update sqlness results

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* resolve conflicts

* update datafusion, again

* fix pyo3 compile error, and update some sqlness results

* update decimal sqlness cases

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: promql literal

* fix udaf tests

* fix filter pushdown sqlness tests

* fix?: test_cast

* fix: rspy test fail due to datafusion `sin` signature change

* rebase main to see if there are any failed tests

* debug ci

* debug ci

* debug ci

* enforce input partition

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* debug ci

* fix ci

* fix ci

* debug ci

* debug ci

* debug ci

* fix sqlness

* feat: do not return error while creating a filter

* chore: remove array from error

* chore: replace todo with unimplemented

* Update src/flow/clippy.toml

Co-authored-by: Yingwen <realevenyag@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: WUJingdi <taylor-lagrange@qq.com>
Co-authored-by: discord9 <discord9@163.com>
Co-authored-by: evenyag <realevenyag@gmail.com>
Co-authored-by: tison <wander4096@gmail.com>
2024-04-18 12:07:18 +00:00

59 lines
1.7 KiB
SQL

CREATE TABLE test (a INTEGER, b INTEGER, ts TIMESTAMP TIME INDEX);
INSERT INTO test VALUES (11, 22, 1), (12, 21, 2), (13, 22, 3);
select b from test where a = 12;
SELECT b FROM test ORDER BY a DESC;
SELECT a, b FROM test ORDER BY a;
SELECT a, b FROM test ORDER BY a DESC;
SELECT a, b FROM test ORDER BY b, a;
SELECT a, b FROM test ORDER BY 2, 1;
SELECT a, b FROM test ORDER BY b DESC, a;
SELECT a, b FROM test ORDER BY b, a DESC;
SELECT a, b FROM test ORDER BY b, a DESC LIMIT 1;
SELECT a, b FROM test ORDER BY b, a DESC LIMIT 1 OFFSET 1;
SELECT a, b FROM test ORDER BY b, a DESC OFFSET 1;
SELECT a, b FROM test WHERE a < 13 ORDER BY b;
SELECT a, b FROM test WHERE a < 13 ORDER BY 2;
SELECT a, b FROM test WHERE a < 13 ORDER BY b DESC;
SELECT b, a FROM test WHERE a < 13 ORDER BY b DESC;
SELECT b % 2 AS f, SUM(a) FROM test GROUP BY f ORDER BY b % 2;
SELECT b % 2 AS f, a FROM test ORDER BY b % 2, a;
SELECT b % 2 AS f, SUM(a) FROM test GROUP BY f ORDER BY f;
SELECT b % 2 AS f, SUM(a) FROM test GROUP BY f ORDER BY 1;
SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY k;
-- ORDER BY on alias in right-most query
-- CONTROVERSIAL: SQLite allows both "k" and "l" to be referenced here, Postgres and MonetDB give an error.
SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY l;
-- Not compatible with duckdb, work in gretimedb
SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY 1-k;
-- Not compatible with duckdb, give an error in greptimedb
SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY a-10;
-- Not compatible with duckdb, give an error in greptimedb
SELECT a-10 AS k FROM test UNION SELECT a-11 AS l FROM test ORDER BY a-11;
DROP TABLE test;