Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions datafusion/sqllogictest/test_files/array/array_distinct.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 0
statement ok
Expand Down
6 changes: 2 additions & 4 deletions datafusion/sqllogictest/test_files/array/array_empty.slt
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,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);
Comment on lines +72 to +73

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its better for it to run to an error so when we fix it later we'll know to also fix this here


# empty scalar function #5
query B
Expand Down
12 changes: 5 additions & 7 deletions datafusion/sqllogictest/test_files/array/array_has.slt
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@ 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 error array_has does not support type 'Null'
select array_has_any([], null),
array_has_any([1, 2, 3], null),
array_has_all([], null),
array_has_all([1, 2, 3], null);
Comment on lines +44 to +48

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these return null, like the select array_distinct(null); above or like in DuckDB? If so, we could split this into two tests, since array_has_any already does not return an error.


query BBBBBBBBBBBB
select array_has(make_array(1,2), 1),
Expand Down
101 changes: 63 additions & 38 deletions datafusion/sqllogictest/test_files/array/array_index.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -141,11 +147,11 @@ 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)
Expand Down Expand Up @@ -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]

Expand All @@ -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 ???
Expand Down
12 changes: 4 additions & 8 deletions datafusion/sqllogictest/test_files/array/array_pop.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 #1
query ??
Expand Down Expand Up @@ -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 #1
query ??
Expand Down
6 changes: 2 additions & 4 deletions datafusion/sqllogictest/test_files/array/array_position.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 #1
query ???
Expand Down
1 change: 0 additions & 1 deletion datafusion/sqllogictest/test_files/array/array_prepend.slt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ select array_prepend(null, [[1,2,3]]);

# DuckDB: [[]]
# ClickHouse: [[]]
# TODO: We may also return [[]]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we already return this

query ?
select array_prepend([], []);
----
Expand Down
6 changes: 2 additions & 4 deletions datafusion/sqllogictest/test_files/datetime/timestamps.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ok
drop table foo;
Expand Down
4 changes: 0 additions & 4 deletions datafusion/sqllogictest/test_files/ddl.slt
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested later in the file now

statement error DataFusion error: Execution error: Cannot drop schema foo_schema because other tables depend on it: bar
DROP SCHEMA foo_schema;
statement ok
DROP SCHEMA foo_schema CASCADE;


##########
# Drop view error tests
##########
Expand Down
Loading
Loading