cloud-fan commented on code in PR #47096:
URL: https://github.com/apache/spark/pull/47096#discussion_r1769191321
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -3027,6 +3027,9 @@ object Encode {
legacyCharsets: Boolean,
legacyErrorAction: Boolean): Array[Byte] = {
val toCharset = charset.toString
+ if (input.numBytes == 0 || "UTF-8".equalsIgnoreCase(toCharset)) {
Review Comment:
this is actually a behavior change. If the input bytes are not valid utf 8
encoding, previously the result was not the same as the input bytes, but now it
is.
We should either remove this utf 8 shortcut, or check the input bytes to see
if it's valid utf8 encoding first.
cc @yaooqinn
--
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]