cloud-fan commented on a change in pull request #34441:
URL: https://github.com/apache/spark/pull/34441#discussion_r740049478
##########
File path:
sql/core/src/test/resources/sql-tests/results/string-functions.sql.out
##########
@@ -533,39 +533,35 @@ AABB
-- !query
-SELECT lpad('abc', 5, x'12')
+SELECT lpad('abc', 5, x'57')
-- !query schema
-struct<>
+struct<lpad(abc, 5, X'57'):string>
-- !query output
-org.apache.spark.sql.AnalysisException
-cannot resolve 'lpad('abc', 5, X'12')' due to data type mismatch: Arguments
'str' and 'pad' of function 'lpad' must be the same type.; line 1 pos 7
+WWabc
Review comment:
What this PR does is: at compile-time, when we see `lpad/rpad` is called
with mixed string/binary inputs, we create `StringL/RPad`.
Then ANSI and non-ANSI has different behaviors: ANSI can not implicitly cast
binary to string, so the query fails analysis (expected). With non-ANSI mode,
we can implicitly cast binary to string, so the result is the same as 3.2 and
before.
--
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]