2010YOUY01 commented on code in PR #23970:
URL: https://github.com/apache/datafusion/pull/23970#discussion_r3681694877


##########
datafusion/sqllogictest/test_files/string/string_literal.slt:
##########
@@ -933,6 +933,63 @@ SELECT find_in_set(arrow_cast('', 'Utf8View'), 
arrow_cast('a,b,c,d,a', 'Utf8View
 ----
 0
 
+# find_in_set with an array on the left and a literal on the right
+query III
+SELECT
+  find_in_set(arrow_cast(column1, 'Utf8'), arrow_cast('a,b,c', 'Utf8')),
+  find_in_set(arrow_cast(column1, 'LargeUtf8'), arrow_cast('a,b,c', 
'LargeUtf8')),
+  find_in_set(arrow_cast(column1, 'Utf8View'), arrow_cast('a,b,c', 'Utf8View'))
+FROM (VALUES ('b'), ('x'), (NULL)) AS t(column1);
+----
+2 2 2
+0 0 0
+NULL NULL NULL
+
+# find_in_set with a literal on the left and an array on the right
+query III
+SELECT
+  find_in_set(arrow_cast('b', 'Utf8'), arrow_cast(column1, 'Utf8')),
+  find_in_set(arrow_cast('b', 'LargeUtf8'), arrow_cast(column1, 'LargeUtf8')),
+  find_in_set(arrow_cast('b', 'Utf8View'), arrow_cast(column1, 'Utf8View'))
+FROM (VALUES ('a,b,c'), ('x,y'), (NULL)) AS t(column1);
+----
+2 2 2
+0 0 0
+NULL NULL NULL
+
+# find_in_set with arrays on both sides
+query III
+SELECT
+  find_in_set(arrow_cast(column1, 'Utf8'), arrow_cast(column2, 'Utf8')),
+  find_in_set(arrow_cast(column1, 'LargeUtf8'), arrow_cast(column2, 
'LargeUtf8')),
+  find_in_set(arrow_cast(column1, 'Utf8View'), arrow_cast(column2, 'Utf8View'))
+FROM (VALUES ('b', 'a,b,c'), ('x', 'x,y'), (NULL, 'a,b'), ('a', NULL)) AS 
t(column1, column2);
+----
+2 2 2
+1 1 1
+NULL NULL NULL
+NULL NULL NULL
+
+# null literals paired with arrays
+query II
+SELECT
+  find_in_set(arrow_cast(column1, 'Utf8'), arrow_cast(NULL, 'Utf8')),
+  find_in_set(arrow_cast(NULL, 'LargeUtf8'), arrow_cast(column1, 'LargeUtf8'))
+FROM (VALUES ('a,b'), (NULL)) AS t(column1);
+----
+NULL NULL
+NULL NULL
+
+# invalid argument count and type
+query error DataFusion error:
+SELECT find_in_set();
+
+query error DataFusion error:
+SELECT find_in_set('a');
+
+query error DataFusion error:
+SELECT find_in_set('a', 'a,b', 'extra');
+

Review Comment:
   updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to