Apache DataFusion SQL Query Engine
chore: cleanup some TODO items in sqllogictests (#23382)
Jeffrey Vo1c1a78a0a424
diff --git a/datafusion/sqllogictest/test_files/array/array_distinct.slt b/datafusion/sqllogictest/test_files/array/array_distinct.sltindex 777ec1ac8a..2682413cac 100644--- a/datafusion/sqllogictest/test_files/array/array_distinct.slt+++ b/datafusion/sqllogictest/test_files/array/array_distinct.slt@@ -19,11 +19,10 @@ include ./init_data.slt.part## array_distinct-#TODO: https://github.com/apache/datafusion/issues/7142-#query ?-#select array_distinct(null);-#-----#NULL+query ?+select array_distinct(null);+----+NULL# test with empty row, the row that does not match the condition has row count 0statement okdiff --git a/datafusion/sqllogictest/test_files/array/array_empty.slt b/datafusion/sqllogictest/test_files/array/array_empty.sltindex 15cf2b4860..800f568934 100644--- a/datafusion/sqllogictest/test_files/array/array_empty.slt+++ b/datafusion/sqllogictest/test_files/array/array_empty.slt@@ -68,10 +68,8 @@ false#TODO: https://github.com/apache/datafusion/issues/7142# empty scalar function #4-#query B-#select empty(NULL);-#-----#NULL+query error array_empty does not support type Null+select empty(NULL);# empty scalar function #5query Bdiff --git a/datafusion/sqllogictest/test_files/array/array_has.slt b/datafusion/sqllogictest/test_files/array/array_has.sltindex e343c1b1fa..82712ece89 100644--- a/datafusion/sqllogictest/test_files/array/array_has.slt+++ b/datafusion/sqllogictest/test_files/array/array_has.slt@@ -41,13 +41,15 @@ select array_has([1, null, 2], 3),false false#TODO: array_has_all and array_has_any cannot handle NULL-#query BBBB-#select array_has_any([], null),-# array_has_any([1, 2, 3], null),-# array_has_all([], null),-# array_has_all([1, 2, 3], null);-#-----#false false false false+query BB+select array_has_any([], null),+ array_has_any([1, 2, 3], null);+----+NULL NULL++query error array_has does not support type 'Null'+select array_has_all([], null),+ array_has_all([1, 2, 3], null);query BBBBBBBBBBBBselect array_has(make_array(1,2), 1),diff --git a/datafusion/sqllogictest/test_files/array/array_index.slt b/datafusion/sqllogictest/test_files/array/array_index.sltindex 9cd033418d..1d9e2989e2 100644--- a/datafusion/sqllogictest/test_files/array/array_index.slt+++ b/datafusion/sqllogictest/test_files/array/array_index.slt@@ -94,17 +94,23 @@ NULL NULL e[13, 14] NULL NULL[NULL, 18] NULL NULL-# TODO: support index as column# single index with columns #5 (index as column)-# query ?-# select make_array(1, 2, 3, 4, 5)[column2] from arrays_with_repeating_elements;-# ----+query I+select make_array(1, 2, 3, 4, 5)[column2] from arrays_with_repeating_elements;+----+2+4+NULL+NULL-# TODO: support argument and index as columns# single index with columns #6 (argument and index as columns)-# query I-# select column1[column2] from arrays_with_repeating_elements;-# ----+query I+select column1[column2] from arrays_with_repeating_elements;+----+2+5+7+10## array[i:j]@@ -141,17 +147,17 @@ select arrow_cast([1, 2, 3], 'LargeList(Int64)')[1];----1-# TODO: support multiple negative index# multiple index with columns #3 (negative index)-# query II-# select make_array(1, 2, 3)[-3:-1], make_array(1.0, 2.0, 3.0)[-3:-1], make_array('h', 'e', 'l', 'l', 'o')[-2:0];-# ----+query ???+select make_array(1, 2, 3)[-3:-1], make_array(1.0, 2.0, 3.0)[-3:-1], make_array('h', 'e', 'l', 'l', 'o')[-2:0];+----+[1, 2, 3] [1.0, 2.0, 3.0] []-# TODO: support complex index# multiple index with columns #4 (complex index)-# query III-# select make_array(1, 2, 3)[2 + 1 - 1:10], make_array(1.0, 2.0, 3.0)[2 | 2:10], make_array('h', 'e', 'l', 'l', 'o')[6 ^ 6:10];-# ----+query ???+select make_array(1, 2, 3)[2 + 1 - 1:10], make_array(1.0, 2.0, 3.0)[(2 | 2):10], make_array('h', 'e', 'l', 'l', 'o')[6 ^ 6:10];+----+[2, 3] [2.0, 3.0] [h, e, l, l, o]# multiple index with columns #1 (positive index)query ???@@ -177,36 +183,56 @@ NULL [13.3, 14.4, 15.5] [a, m, e, t][[11, 12], [13, 14]] NULL [,][[15, 16], [NULL, 18]] [16.6, 17.7, 18.8] NULL-# TODO: support negative index# multiple index with columns #3 (negative index)-# query ?RT-# select column1[-2:-4], column2[-3:-5], column3[-1:-4] from arrays;-# -----# [NULL, 2] 1.1 m+query ???+select column1[-2:-4], column2[-3:-5], column3[-1:-4] from arrays;+----+[] [] []+[] [] []+[] [] []+[] [] []+NULL [] []+[] NULL []+[] [] NULL-# TODO: support complex index# multiple index with columns #4 (complex index)-# query ?RT-# select column1[9 - 7:2 + 2], column2[1 * 0:2 * 3], column3[1 + 1 - 0:5 % 3] from arrays;-# ----+query ???+select column1[9 - 7:2 + 2], column2[1 * 0:2 * 3], column3[1 + 1 - 0:5 % 3] from arrays;+----+[[3, NULL]] [1.1, 2.2, 3.3] [o]+[[5, 6]] [NULL, 5.5, 6.6] [p]+[[7, 8]] [7.7, 8.8, 9.9] [NULL]+[[9, 10]] [10.1, NULL, 12.2] [i]+NULL [13.3, 14.4, 15.5] [m]+[[13, 14]] NULL []+[[NULL, 18]] [16.6, 17.7, 18.8] NULL-# TODO: support first index as column# multiple index with columns #5 (first index as column)-# query ?-# select make_array(1, 2, 3, 4, 5)[column2:4] from arrays_with_repeating_elements-# ----+query ?+select make_array(1, 2, 3, 4, 5)[column2:4] from arrays_with_repeating_elements+----+[2, 3, 4]+[4]+[]+[]-# TODO: support last index as column# multiple index with columns #6 (last index as column)-# query ?RT-# select make_array(1, 2, 3, 4, 5)[2:column3] from arrays_with_repeating_elements;-# ----+query ?+select make_array(1, 2, 3, 4, 5)[2:column3] from arrays_with_repeating_elements;+----+[2, 3, 4]+[2, 3, 4, 5]+[2, 3, 4, 5]+[2, 3, 4, 5]-# TODO: support argument and indices as column# multiple index with columns #7 (argument and indices as column)-# query ?RT-# select column1[column2:column3] from arrays_with_repeating_elements;-# ----+query ?+select column1[column2:column3] from arrays_with_repeating_elements;+----+[2, 1, 3]+[5, 6, 5, 5]+[7, 8, 7, 7]+[10]# array[i:j:k]@@ -222,12 +248,11 @@ select make_array(1, 2, 3)[0:0:2], make_array(1.0, 2.0, 3.0)[0:2:2], make_array(----[] [1.0] [h, l, o]-#TODO: sqlparser does not support negative index## multiple index with columns #3 (negative index)-#query ???-#select make_array(1, 2, 3)[-1:-2:-2], make_array(1.0, 2.0, 3.0)[-2:-3:-2], make_array('h', 'e', 'l', 'l', 'o')[-2:-4:-2];-#-----#[1] [2.0] [e, l]+query ???+select make_array(1, 2, 3)[-1:-2:-2], make_array(1.0, 2.0, 3.0)[-2:-3:-2], make_array('h', 'e', 'l', 'l', 'o')[-2:-4:-2];+----+[3] [2.0] [l, e]# multiple index with columns #1 (positive index)query ???diff --git a/datafusion/sqllogictest/test_files/array/array_pop.slt b/datafusion/sqllogictest/test_files/array/array_pop.sltindex b830fa464a..a72e566b9e 100644--- a/datafusion/sqllogictest/test_files/array/array_pop.slt+++ b/datafusion/sqllogictest/test_files/array/array_pop.slt@@ -22,10 +22,8 @@ include ./init_data.slt.part# array_pop_back scalar function with null#TODO: https://github.com/apache/datafusion/issues/7142# follow clickhouse and duckdb-#query ?-#select array_pop_back(null);-#-----#NULL+query error array_pop_back does not support type: Null+select array_pop_back(null);# array_pop_back scalar function #1query ??@@ -201,10 +199,8 @@ NULL#TODO:https://github.com/apache/datafusion/issues/7142# array_pop_front scalar function with null# follow clickhouse and duckdb-#query ?-#select array_pop_front(null);-#-----#NULL+query error array_pop_front does not support type: Null+select array_pop_front(null);# array_pop_front scalar function #1query ??diff --git a/datafusion/sqllogictest/test_files/array/array_position.slt b/datafusion/sqllogictest/test_files/array/array_position.sltindex 07e3d31435..e3dd830dfb 100644--- a/datafusion/sqllogictest/test_files/array/array_position.slt+++ b/datafusion/sqllogictest/test_files/array/array_position.slt@@ -314,10 +314,8 @@ select array_positions([1, 2, 3, 4, 5], null);#TODO: https://github.com/apache/datafusion/issues/7142# array_positions with NULL (follow PostgreSQL)-#query ?-#select array_positions(null, 1);-#-----#NULL+query error array_positions does not support type 'Null'+select array_positions(null, 1);# array_positions scalar function #1query ???diff --git a/datafusion/sqllogictest/test_files/array/array_prepend.slt b/datafusion/sqllogictest/test_files/array/array_prepend.sltindex 0782680ed2..14b53e93b3 100644--- a/datafusion/sqllogictest/test_files/array/array_prepend.slt+++ b/datafusion/sqllogictest/test_files/array/array_prepend.slt@@ -57,7 +57,6 @@ select array_prepend(null, [[1,2,3]]);# DuckDB: [[]]# ClickHouse: [[]]-# TODO: We may also return [[]]query ?select array_prepend([], []);----diff --git a/datafusion/sqllogictest/test_files/datetime/timestamps.slt b/datafusion/sqllogictest/test_files/datetime/timestamps.sltindex 06740fa0f5..8ba095ef93 100644--- a/datafusion/sqllogictest/test_files/datetime/timestamps.slt+++ b/datafusion/sqllogictest/test_files/datetime/timestamps.slt@@ -1936,10 +1936,8 @@ SELECT '2000-01-01T00:00:00'::timestamp - '2010-01-01T00:00:00'::timestamp;-3653 days 0 hours 0 mins 0.000000000 secs# Interval - Timestamp => error-# statement error DataFusion error: Error during planning: Cannot coerce arithmetic expression Interval\(MonthDayNano\) \- Timestamp\(Nanosecond, None\) to valid types-# TODO: This query should raise error-# query P-# SELECT i - ts1 from FOO;+query error Cannot coerce arithmetic expression Interval\(MonthDayNano\) - Timestamp\(ns\) to valid types+SELECT i - ts1 from FOO;statement okdrop table foo;diff --git a/datafusion/sqllogictest/test_files/ddl.slt b/datafusion/sqllogictest/test_files/ddl.sltindex 3f2825c09c..e1a48ce5e8 100644--- a/datafusion/sqllogictest/test_files/ddl.slt+++ b/datafusion/sqllogictest/test_files/ddl.slt@@ -200,10 +200,6 @@ SELECT foo_schema.bar.a FROM foo_schema.bar;----1-# TODO: Drop schema for cleanup, see #6027-# statement ok-# DROP SCHEMA foo_schema;-########### Drop view error tests##########diff --git a/datafusion/sqllogictest/test_files/expr.slt b/datafusion/sqllogictest/test_files/expr.sltindex 51b7591b41..7e15b48a0d 100644--- a/datafusion/sqllogictest/test_files/expr.slt+++ b/datafusion/sqllogictest/test_files/expr.slt@@ -67,7 +67,7 @@ statement error Parser error: Invalid timezone "Foo": failed to parse timezoneSELECT arrow_cast('2021-01-02T03:04:00', 'Timestamp(Nanosecond, Some("Foo"))')# test_array_index-query III??IIIIII+query III??IIIIIIIISELECT([5,4,3,2,1])[1],([5,4,3,2,1])[2],@@ -80,11 +80,11 @@ SELECT-- out of bounds([5,4,3,2,1])[0],([5,4,3,2,1])[6],- -- ([5,4,3,2,1])[-1], -- TODO: wrong answer- -- ([5,4,3,2,1])[null], -- TODO: not supported+ ([5,4,3,2,1])[-1],+ ([5,4,3,2,1])[null],([5,4,3,2,1])[100]-----5 4 1 [1, 2] [3, 4] 1 3 4 NULL NULL NULL+5 4 1 [1, 2] [3, 4] 1 3 4 NULL NULL 1 NULL NULL# test_array_literalsquery ?????@@ -330,7 +330,7 @@ SELECT ascii('222')50query I-SELECT ascii('0xa')+SELECT ascii('0xa')----48@@ -561,7 +561,7 @@ NULLquery TSELECT ltrim(' zzzytest ')-----zzzytest+zzzytestquery TSELECT ltrim('zzzytest', 'xyz')@@ -985,17 +985,16 @@ SELECT upper(NULL)----NULL-# TODO issue: https://github.com/apache/datafusion/issues/6596-# query ??-#SELECT-# CAST([1,2,3,4] AS INT[]) as a,-# CAST([1,2,3,4] AS NUMERIC(10,4)[]) as b-#-----#[1, 2, 3, 4] [1.0000, 2.0000, 3.0000, 4.0000]+query ??+SELECT+ CAST([1,2,3,4] AS INT[]) as a,+ CAST([1,2,3,4] AS NUMERIC(10,4)[]) as b+----+[1, 2, 3, 4] [1.0000, 2.0000, 3.0000, 4.0000]# test_random_expressionquery BB-SELECT+SELECTrandom() BETWEEN 0.0 AND 1.0,random() = random()----@@ -1978,15 +1977,15 @@ query Bselect column1 <=> column2 from (VALUES (1, 1), (2, 3), (NULL, NULL)) as t;----true-false+falsetrue# Sanity test - comparing <=> with equivalent expressionquery B-SELECT- (column1 <=> column2) =+SELECT+ (column1 <=> column2) =(IFNULL(column1, false) = IFNULL(column2, false)) AS comparison_result-FROM (VALUES+FROM (VALUES(1, 1), -- equal values(1, 2), -- different values(NULL, NULL), -- both NULL@@ -2280,20 +2279,20 @@ host3 3.3# can have an aggregate function with an inner CASE WHENquery TR-select- t2.server_host as host,+select+ t2.server_host as host,sum((- case when t2.server_host is not null+ case when t2.server_host is not nullthen t2.server_load2end- ))+ ))from (- select+ selectstruct(time,load1,load2,host)['c2'] as server_load2,struct(time,load1,load2,host)['c3'] as server_hostfrom t1- ) t2- where server_host IS NOT NULL+ ) t2+ where server_host IS NOT NULLgroup by server_host order by host;----host1 101@@ -2302,19 +2301,19 @@ host3 303# TODO: Issue tracked in https://github.com/apache/datafusion/issues/10364query TR-select- t2.server['c3'] as host,+select+ t2.server['c3'] as host,sum((- case when t2.server['c3'] is not null+ case when t2.server['c3'] is not nullthen t2.server['c2']end- ))+ ))from (- select+ selectstruct(time,load1,load2,host) as serverfrom t1- ) t2- where t2.server['c3'] IS NOT NULL+ ) t2+ where t2.server['c3'] IS NOT NULLgroup by t2.server['c3'] order by host;----host1 101@@ -2323,22 +2322,22 @@ host3 303# can have 2 projections with aggr(short_circuited), with different short-circuited exprquery TRR-select- t2.server_host as host,+select+ t2.server_host as host,sum(coalesce(server_load1)),sum((- case when t2.server_host is not null+ case when t2.server_host is not nullthen t2.server_load2end- ))+ ))from (- select+ selectstruct(time,load1,load2,host)['c1'] as server_load1,struct(time,load1,load2,host)['c2'] as server_load2,struct(time,load1,load2,host)['c3'] as server_hostfrom t1- ) t2- where server_host IS NOT NULL+ ) t2+ where server_host IS NOT NULLgroup by server_host order by host;----host1 1.1 101@@ -2347,43 +2346,43 @@ host3 3.3 303# TODO: Issue tracked in https://github.com/apache/datafusion/issues/10364query error-select- t2.server['c3'] as host,+select+ t2.server['c3'] as host,sum(coalesce(server['c1'])),sum((- case when t2.server['c3'] is not null+ case when t2.server['c3'] is not nullthen t2.server['c2']end- ))+ ))from (- select+ selectstruct(time,load1,load2,host) as server,from t1- ) t2- where server_host IS NOT NULL+ ) t2+ where server_host IS NOT NULLgroup by server_host order by host;query TRR-select- t2.server_host as host,+select+ t2.server_host as host,sum((- case when t2.server_host is not null- then server_load1+ case when t2.server_host is not null+ then server_load1end- )),+ )),sum((- case when server_host is not null- then server_load2+ case when server_host is not null+ then server_load2end- ))+ ))from (- select+ selectstruct(time,load1,load2,host)['c1'] as server_load1,struct(time,load1,load2,host)['c2'] as server_load2,struct(time,load1,load2,host)['c3'] as server_hostfrom t1- ) t2- where server_host IS NOT NULL+ ) t2+ where server_host IS NOT NULLgroup by server_host order by host;----host1 1.1 101@@ -2392,24 +2391,24 @@ host3 3.3 303# TODO: Issue tracked in https://github.com/apache/datafusion/issues/10364query TRR-select- t2.server['c3'] as host,+select+ t2.server['c3'] as host,sum((- case when t2.server['c3'] is not null+ case when t2.server['c3'] is not nullthen t2.server['c1']end- )),+ )),sum((- case when t2.server['c3'] is not null+ case when t2.server['c3'] is not nullthen t2.server['c2']end- ))+ ))from (- select- struct(time,load1,load2,host) as server+ select+ struct(time,load1,load2,host) as serverfrom t1- ) t2- where t2.server['c3'] IS NOT NULL+ ) t2+ where t2.server['c3'] IS NOT NULLgroup by t2.server['c3'] order by host;----host1 1.1 101diff --git a/datafusion/sqllogictest/test_files/map.slt b/datafusion/sqllogictest/test_files/map.sltindex 2b390c3748..970ae2707d 100644--- a/datafusion/sqllogictest/test_files/map.slt+++ b/datafusion/sqllogictest/test_files/map.slt@@ -579,7 +579,7 @@ SELECT MAP { 'a': 1, 'b': 2, 'c': 3 }['a'];# accessing map with non-string key in case expressionquery I-SELECT (CASE WHEN 1 > 0 THEN MAP {'x': 100} ELSE MAP {'y': 200} END)['x'];+SELECT (CASE WHEN 1 > 0 THEN MAP {'x': 100} ELSE MAP {'y': 200} END)['x'];----100