Skip to content

Commit 5d5a4e6

Browse files
committed
Add more tests
Signed-off-by: Chojan Shang <[email protected]>
1 parent 2bf0a0d commit 5d5a4e6

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

datafusion/sqllogictest/test_files/functions.slt

+18-1
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ docs.apache.com docs com
10661066
community.influxdata.com community com
10671067
arrow.apache.org arrow org
10681068

1069-
1069+
# find_in_set tests
10701070
query I
10711071
SELECT find_in_set('b', 'a,b,c,d')
10721072
----
@@ -1110,6 +1110,23 @@ SELECT find_in_set(NULL, NULL)
11101110
----
11111111
NULL
11121112

1113+
# find_in_set tests with utf8view
1114+
query I
1115+
SELECT find_in_set(arrow_cast('b', 'Utf8View'), 'a,b,c,d')
1116+
----
1117+
2
1118+
1119+
1120+
query I
1121+
SELECT find_in_set('a', arrow_cast('a,b,c,d,a', 'Utf8View'))
1122+
----
1123+
1
1124+
1125+
query I
1126+
SELECT find_in_set(arrow_cast('', 'Utf8View'), arrow_cast('a,b,c,d,a', 'Utf8View'))
1127+
----
1128+
0
1129+
11131130
# Verify that multiple calls to volatile functions like `random()` are not combined / optimized away
11141131
query B
11151132
SELECT r FROM (SELECT r1 == r2 r, r1, r2 FROM (SELECT random()+1 r1, random()+1 r2) WHERE r1 > 0 AND r2 > 0)

datafusion/sqllogictest/test_files/string_view.slt

+9-3
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,6 @@ logical_plan
906906
02)--TableScan: test projection=[column1_utf8view]
907907

908908
## Ensure no casts for FIND_IN_SET
909-
## TODO file ticket
910909
query TT
911910
EXPLAIN SELECT
912911
FIND_IN_SET(column1_utf8view, 'a,b,c,d') as c
@@ -916,8 +915,15 @@ logical_plan
916915
01)Projection: find_in_set(test.column1_utf8view, Utf8View("a,b,c,d")) AS c
917916
02)--TableScan: test projection=[column1_utf8view]
918917

919-
920-
918+
query I
919+
SELECT
920+
FIND_IN_SET(column1_utf8view, 'a,b,c,d') as c
921+
FROM test;
922+
----
923+
0
924+
0
925+
0
926+
NULL
921927

922928
statement ok
923929
drop table test;

0 commit comments

Comments
 (0)