andygrove commented on code in PR #373:
URL: https://github.com/apache/datafusion-spark/pull/373#discussion_r4643208601


##########
crates/sqllogictest/test_files/string/find_in_set.slt:
##########
@@ -220,3 +220,64 @@ SELECT find_in_set(arrow_cast(a, 'LargeUtf8'), 
arrow_cast('abc,b,ab,c,def', 'Lar
 3
 0
 NULL
+
+# Spark implicitly casts both arguments to strings.
+query II
+SELECT find_in_set(2::INT, '1,2,3'), find_in_set('2', 2::INT);
+----
+2 1
+
+query I
+SELECT find_in_set(a, 'false,true')
+FROM (VALUES (true), (false), (NULL::BOOLEAN)) AS t(a);
+----
+2
+1
+NULL
+
+query I
+SELECT find_in_set(X'62', 'a,b');
+----
+2
+
+query I
+SELECT find_in_set(DATE '2020-01-01', 'x,2020-01-01');

Review Comment:
   The DATE case matches Spark, but a few other implicit casts don't yet, 
because the planner uses DataFusion's cast rather than Spark's. On Spark 4.2.0, 
`find_in_set(TIMESTAMP '2020-01-01 00:00:00', 'x,2020-01-01 00:00:00')` returns 
2 and `find_in_set(1e20::DOUBLE, '1.0E20,100000000000000000000')` returns 1, 
while here both return 0. `find_in_set(X'FF', 'a,b')` returns 0 on Spark but 
fails here with `Encountered non UTF-8 data`. All three are covered by #88. 
Could you add them as records with the current DataFusion results (and 
`statement error` for the binary one), each with an `# xfail spark:` marker 
that links #88? That way they get flipped when the cast port lands instead of 
being forgotten.
   



-- 
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