Skip to content

Commit

Permalink
update sqlness result
Browse files Browse the repository at this point in the history
Signed-off-by: Ruihang Xia <[email protected]>
  • Loading branch information
waynexia committed Nov 22, 2023
1 parent e36c2ff commit 5642750
Show file tree
Hide file tree
Showing 22 changed files with 118 additions and 118 deletions.
2 changes: 1 addition & 1 deletion src/common/recordbatch/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum Error {
location: Location,
},

#[snafu(display("Failed to poll result stream"))]
#[snafu(display(""))]
PollStream {
#[snafu(source)]
error: datafusion::error::DataFusionError,
Expand Down
4 changes: 2 additions & 2 deletions tests/cases/distributed/optimizer/filter_push_down.result
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ SELECT * FROM integers i1 WHERE NOT EXISTS(SELECT i FROM integers WHERE i=i1.i)

SELECT i1.i,i2.i FROM integers i1, integers i2 WHERE i1.i=(SELECT i FROM integers WHERE i1.i=i) AND i1.i=i2.i ORDER BY i1.i;

Error: 3001(EngineExecuteQuery), Error during planning: Correlated scalar subquery must be aggregated to return at most one row
Error: 3001(EngineExecuteQuery), DataFusion error: Error during planning: Correlated scalar subquery must be aggregated to return at most one row

SELECT * FROM (SELECT i1.i AS a, i2.i AS b FROM integers i1, integers i2) a1 WHERE a=b ORDER BY 1;

Expand Down Expand Up @@ -241,7 +241,7 @@ Error: 3001(EngineExecuteQuery), Invalid argument error: must either specify a r

SELECT * FROM (SELECT 0=1 AS cond FROM integers i1, integers i2 GROUP BY 1) a1 WHERE cond ORDER BY 1;

Error: 3001(EngineExecuteQuery), Error during planning: Attempted to create Filter predicate with expression `Boolean(false)` aliased as 'Int64(0) = Int64(1)'. Filter predicates should not be aliased.
Error: 3001(EngineExecuteQuery), DataFusion error: Error during planning: Attempted to create Filter predicate with expression `Boolean(false)` aliased as 'Int64(0) = Int64(1)'. Filter predicates should not be aliased.

DROP TABLE integers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ SELECT DISTINCT i%2 FROM integers ORDER BY 1;
-- +-----------------------+
SELECT DISTINCT i % 2 FROM integers WHERE i<3 ORDER BY i;

Error: 3000(PlanQuery), Error during planning: For SELECT DISTINCT, ORDER BY expressions i must appear in select list
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: For SELECT DISTINCT, ORDER BY expressions i must appear in select list

SELECT DISTINCT ON (1) i % 2, i FROM integers WHERE i<3 ORDER BY i;

Error: 3000(PlanQuery), This feature is not implemented: DISTINCT ON Exprs not supported
Error: 3000(PlanQuery), Failed to plan SQL: This feature is not implemented: DISTINCT ON Exprs not supported

SELECT DISTINCT integers.i FROM integers ORDER BY i DESC;

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/standalone/common/alter/rename_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Error: 4001(TableNotFound), Table not found: t

SELECT * FROM t;

Error: 3000(PlanQuery), Error during planning: Table not found: greptime.public.t
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.public.t

CREATE TABLE t(i INTEGER, j TIMESTAMP TIME INDEX);

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/standalone/common/catalog/schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Error: 1001(Unsupported), SQL statement is not supported: DROP SCHEMA test_publi

SELECT * FROM test_public_schema.hello;

Error: 3000(PlanQuery), Error during planning: Table not found: greptime.test_public_schema.hello
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.test_public_schema.hello

USE public;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Affected Rows: 2

select * from system_Metric;

Error: 3000(PlanQuery), Error during planning: Table not found: greptime.upper_case_table_name.system_metric
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.upper_case_table_name.system_metric

select * from "system_Metric";

Expand Down
8 changes: 4 additions & 4 deletions tests/cases/standalone/common/cte/cte.result
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ with cte1 as (select i as j from a), cte2 as (select ref.j as k from cte1 as ref

with cte1 as (select 42), cte1 as (select 42) select * FROM cte1;

Error: 3000(PlanQuery), sql parser error: WITH query name "cte1" specified more than once
Error: 3000(PlanQuery), Failed to plan SQL: sql parser error: WITH query name "cte1" specified more than once

-- reference to CTE before its actually defined, it's not supported by datafusion
with cte3 as (select ref2.j as i from cte1 as ref2), cte1 as (Select i as j from a), cte2 as (select ref.j+1 as k from cte1 as ref) select * from cte2 union all select * FROM cte3;

Error: 3000(PlanQuery), Error during planning: Table not found: greptime.public.cte1
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.public.cte1

with cte1 as (Select i as j from a) select * from cte1 cte11, cte1 cte12;

Expand Down Expand Up @@ -109,7 +109,7 @@ WITH RECURSIVE cte(d) AS (
)
SELECT max(d) FROM cte;

Error: 3000(PlanQuery), This feature is not implemented: Recursive CTEs are not supported
Error: 3000(PlanQuery), Failed to plan SQL: This feature is not implemented: Recursive CTEs are not supported

-- Nested aliases is not supported in datafusion
with cte (a) as (
Expand All @@ -121,7 +121,7 @@ select
from cte
where alias2 > 0;

Error: 3000(PlanQuery), No field named alias2. Valid fields are cte.a.
Error: 3000(PlanQuery), Failed to plan SQL: No field named alias2. Valid fields are cte.a.

drop table a;

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/standalone/common/cte/cte_in_cte.result
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ with cte1 as (with b as (Select i as j from a) select j from b), cte2 as (with c

with cte1 as (select 42), cte1 as (select 42) select * FROM cte1;

Error: 3000(PlanQuery), sql parser error: WITH query name "cte1" specified more than once
Error: 3000(PlanQuery), Failed to plan SQL: sql parser error: WITH query name "cte1" specified more than once

with cte1 as (Select i as j from a) select * from (with cte2 as (select max(j) as j from cte1) select * from cte2) f;

Expand All @@ -64,12 +64,12 @@ with cte1 as (Select i as j from a) select * from cte1 where j = (with cte2 as (
-- this feature is not implemented in datafusion
with cte as (Select i as j from a) select * from cte where j = (with cte as (select max(j) as j from cte) select j from cte);

Error: 3000(PlanQuery), sql parser error: WITH query name "cte" specified more than once
Error: 3000(PlanQuery), Failed to plan SQL: sql parser error: WITH query name "cte" specified more than once

-- self-refer to non-existent cte-
with cte as (select * from cte) select * from cte;

Error: 3000(PlanQuery), Error during planning: Table not found: greptime.public.cte
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Table not found: greptime.public.cte

drop table a;

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/standalone/common/insert/insert_select.result
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Affected Rows: 2

insert into demo2(host) select * from demo1;

Error: 3000(PlanQuery), Error during planning: Column count doesn't match insert query!
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Column count doesn't match insert query!

insert into demo2 select cpu,memory from demo1;

Error: 3000(PlanQuery), Error during planning: Column count doesn't match insert query!
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Column count doesn't match insert query!

insert into demo2(ts) select memory from demo1;

Error: 3000(PlanQuery), Error during planning: Cannot automatically convert Float64 to Timestamp(Millisecond, None)
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Cannot automatically convert Float64 to Timestamp(Millisecond, None)

insert into demo2 select * from demo1;

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/standalone/common/insert/special_value.result
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ select * from data;

insert into data values (4, 'infinityyyy'::double);

Error: 3001(EngineExecuteQuery), Cast error: Cannot cast string 'infinityyyy' to value of Float64 type
Error: 3001(EngineExecuteQuery), DataFusion error: Cast error: Cannot cast string 'infinityyyy' to value of Float64 type

drop table data;

Expand Down
30 changes: 15 additions & 15 deletions tests/cases/standalone/common/order/limit.result
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ SELECT a FROM test LIMIT 1;

SELECT a FROM test LIMIT 1.25;

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT a FROM test LIMIT 2-1;

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT a FROM test LIMIT a;

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT a FROM test LIMIT a+1;

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT a FROM test LIMIT SUM(42);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT a FROM test LIMIT row_number() OVER ();

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

CREATE TABLE test2 (a STRING, ts TIMESTAMP TIME INDEX);

Expand All @@ -56,7 +56,7 @@ SELECT * FROM test2 LIMIT 3;

select 1 limit date '1992-01-01';

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

CREATE TABLE integers(i TIMESTAMP TIME INDEX);

Expand Down Expand Up @@ -89,35 +89,35 @@ SELECT * FROM integers LIMIT 4;

SELECT * FROM integers as int LIMIT (SELECT MIN(integers.i) FROM integers);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT * FROM integers as int OFFSET (SELECT MIN(integers.i) FROM integers);

Error: 3000(PlanQuery), Error during planning: Unexpected expression in OFFSET clause
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Unexpected expression in OFFSET clause

SELECT * FROM integers as int LIMIT (SELECT MAX(integers.i) FROM integers) OFFSET (SELECT MIN(integers.i) FROM integers);

Error: 3000(PlanQuery), Error during planning: Unexpected expression in OFFSET clause
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Unexpected expression in OFFSET clause

SELECT * FROM integers as int LIMIT (SELECT max(integers.i) FROM integers where i > 5);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT * FROM integers as int LIMIT (SELECT max(integers.i) FROM integers where i > 5);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT * FROM integers as int LIMIT (SELECT NULL);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT * FROM integers as int LIMIT (SELECT -1);

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

SELECT * FROM integers as int LIMIT (SELECT 'ab');

Error: 3000(PlanQuery), Error during planning: LIMIT must not be negative
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: LIMIT must not be negative

DROP TABLE integers;

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/standalone/common/order/order_by.result
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY k;
-- 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;

Error: 3000(PlanQuery), No field named l. Valid fields are k.
Error: 3000(PlanQuery), Failed to plan SQL: No field named l. Valid fields are k.

-- 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;
Expand All @@ -215,15 +215,15 @@ SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY 1-k;
-- Error: 3000(PlanQuery), Schema error: No field named 'a'. Valid fields are 'k'.
SELECT a-10 AS k FROM test UNION SELECT a-10 AS l FROM test ORDER BY a-10;

Error: 3000(PlanQuery), Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list

-- Not compatible with duckdb, give an error in greptimedb
-- TODO(LFC): Failed to meet the expected error:
-- expected:
-- Error: 3000(PlanQuery), Schema error: No field named 'a'. Valid fields are 'k'.
SELECT a-10 AS k FROM test UNION SELECT a-11 AS l FROM test ORDER BY a-11;

Error: 3000(PlanQuery), Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list

DROP TABLE test;

Expand Down
10 changes: 5 additions & 5 deletions tests/cases/standalone/common/order/order_by_exceptions.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Affected Rows: 3

SELECT a FROM test ORDER BY 2;

Error: 3000(PlanQuery), Error during planning: Order by column out of bounds, specified: 2, max: 1
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Order by column out of bounds, specified: 2, max: 1

-- Not work in greptimedb
SELECT a FROM test ORDER BY 'hello', a;
Expand Down Expand Up @@ -38,27 +38,27 @@ SELECT a AS k, b FROM test UNION SELECT a AS k, b FROM test ORDER BY k;

SELECT a % 2, b FROM test UNION SELECT b, a % 2 AS k ORDER BY a % 2;

Error: 3000(PlanQuery), No field named b.
Error: 3000(PlanQuery), Failed to plan SQL: No field named b.

-- Works duckdb, but not work in greptimedb
-- TODO(LFC): Failed to meet the expected error:
-- expected:
-- Error: 3000(PlanQuery), Schema error: No field named 'a'. Valid fields are 'test.a % Int64(2)', 'b'.
SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY a % 2;

Error: 3000(PlanQuery), Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: For SELECT DISTINCT, ORDER BY expressions a must appear in select list

SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY 3;

Error: 3000(PlanQuery), Error during planning: Order by column out of bounds, specified: 3, max: 2
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Order by column out of bounds, specified: 3, max: 2

SELECT a % 2, b FROM test UNION SELECT a % 2 AS k, b FROM test ORDER BY -1;

Error: 3001(EngineExecuteQuery), Error during planning: Sort operation is not applicable to scalar value -1

SELECT a % 2, b FROM test UNION SELECT a % 2 AS k FROM test ORDER BY -1;

Error: 3000(PlanQuery), Error during planning: Union queries must have the same number of columns, (left is 2, right is 1)
Error: 3000(PlanQuery), Failed to plan SQL: Error during planning: Union queries must have the same number of columns, (left is 2, right is 1)

DROP TABLE test;

Expand Down
2 changes: 1 addition & 1 deletion tests/cases/standalone/common/range/by.result
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ SELECT ts, CAST(length(host) as INT64) + 2, max(val) RANGE '5s' FROM host ALIGN
-- project non-aggregation key
SELECT ts, host, max(val) RANGE '5s' FROM host ALIGN '20s' BY () ORDER BY ts;

Error: 3001(EngineExecuteQuery), No field named host.host. Valid fields are "MAX(host.val) RANGE 5s FILL NULL", host.ts, "Int64(1)".
Error: 3001(EngineExecuteQuery), DataFusion error: No field named host.host. Valid fields are "MAX(host.val) RANGE 5s FILL NULL", host.ts, "Int64(1)".

DROP TABLE host;

Expand Down
8 changes: 4 additions & 4 deletions tests/cases/standalone/common/range/error.result
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Error: 2000(InvalidSyntax), sql parser error: Illegal Range select, no RANGE key

SELECT min(val) RANGE '10s', max(val) FROM host ALIGN '5s';

Error: 3001(EngineExecuteQuery), No field named "MAX(host.val)". Valid fields are "MIN(host.val) RANGE 10s FILL NULL", host.ts, host.host.
Error: 3001(EngineExecuteQuery), DataFusion error: No field named "MAX(host.val)". Valid fields are "MIN(host.val) RANGE 10s FILL NULL", host.ts, host.host.

SELECT min(val) * 2 RANGE '10s' FROM host ALIGN '5s';

Expand All @@ -54,7 +54,7 @@ Error: 2000(InvalidSyntax), sql parser error: Can't use the RANGE keyword in Exp
-- 2.2 no align param
SELECT min(val) RANGE '5s' FROM host;

Error: 3000(PlanQuery), Error during planning: Missing argument in range select query
Error: 3000(PlanQuery), DataFusion error: Error during planning: Missing argument in range select query

-- 2.3 type mismatch
SELECT covar(ceil(val), floor(val)) RANGE '20s' FROM host ALIGN '10s';
Expand All @@ -75,11 +75,11 @@ Error: 2000(InvalidSyntax), Range Query: Window functions is not allowed in Rang
-- 2.6 invalid fill
SELECT min(val) RANGE '5s', min(val) RANGE '5s' FILL NULL FROM host ALIGN '5s';

Error: 3001(EngineExecuteQuery), Schema contains duplicate unqualified field name "MIN(host.val) RANGE 5s FILL NULL"
Error: 3001(EngineExecuteQuery), DataFusion error: Schema contains duplicate unqualified field name "MIN(host.val) RANGE 5s FILL NULL"

SELECT min(val) RANGE '5s' FROM host ALIGN '5s' FILL 3.0;

Error: 3000(PlanQuery), Error during planning: 3.0 is not a valid fill option, fail to convert to a const value. { Arrow error: Cast error: Cannot cast string '3.0' to value of Int64 type }
Error: 3000(PlanQuery), DataFusion error: Error during planning: 3.0 is not a valid fill option, fail to convert to a const value. { Arrow error: Cast error: Cannot cast string '3.0' to value of Int64 type }

DROP TABLE host;

Expand Down
6 changes: 3 additions & 3 deletions tests/cases/standalone/common/select/dummy.result
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ select 4 + 0.5;

select "a";

Error: 3000(PlanQuery), No field named a.
Error: 3000(PlanQuery), Failed to plan SQL: No field named a.

select "A";

Error: 3000(PlanQuery), No field named "A".
Error: 3000(PlanQuery), Failed to plan SQL: No field named "A".

select * where "a" = "A";

Error: 3000(PlanQuery), No field named a.
Error: 3000(PlanQuery), Failed to plan SQL: No field named a.

select TO_UNIXTIME('2023-03-01T06:35:02Z');

Expand Down
Loading

0 comments on commit 5642750

Please sign in to comment.