Jefffrey commented on code in PR #22244:
URL: https://github.com/apache/datafusion/pull/22244#discussion_r3297492567


##########
datafusion/sqllogictest/test_files/spark/string/concat.slt:
##########
@@ -71,67 +72,22 @@ SELECT concat('a', arrow_cast('b', 'LargeUtf8'), 
arrow_cast('c', 'Utf8View')), a
 ----
 abc Utf8View
 
-# Test mixed types: Utf8 + Binary
-query TT
-SELECT concat(arrow_cast('hello', 'Utf8'), arrow_cast(' world', 'Binary')), 
arrow_typeof(concat(arrow_cast('hello', 'Utf8'), arrow_cast(' world', 
'Binary')));
-----
-hello world Utf8
+# Coercion rules from Binary to Utf8 do no apply compared to generic `concat`,
+# so `concat` produces an explicit error
+query error Error during planning: concat does not support mixed string and 
binary inputs
+SELECT concat(arrow_cast('hello', 'Utf8'), arrow_cast(' world', 'Binary'));

Review Comment:
   Actually I'm a little confused now since I was quickly testing with Spark 
and got this:
   
   ```python
   >>> spark.version
   '4.1.2'
   >>> spark.sql("select concat(x'1234', '1234')").show();
   +---------------------+
   |concat(X'1234', 1234)|
   +---------------------+
   |               41234|
   +---------------------+
   
   >>> spark.sql("select concat(x'1234', '1234')").explain(True);
   == Parsed Logical Plan ==
   'Project [unresolvedalias('concat(0x1234, 1234))]
   +- OneRowRelation
   
   == Analyzed Logical Plan ==
   concat(X'1234', 1234): string
   Project [concat(cast(0x1234 as string), 1234) AS concat(X'1234', 1234)#19]
   +- OneRowRelation
   
   == Optimized Logical Plan ==
   Project [41234 AS concat(X'1234', 1234)#19]
   +- OneRowRelation
   
   == Physical Plan ==
   *(1) Project [41234 AS concat(X'1234', 1234)#19]
   +- *(1) Scan OneRowRelation[]
   ```
   
   Seems it'll automatically cast binaries to string?



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