yaooqinn commented on code in PR #48203:
URL: https://github.com/apache/spark/pull/48203#discussion_r1770880836
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -3039,7 +3039,7 @@ object Encode {
legacyCharsets: Boolean,
legacyErrorAction: Boolean): Array[Byte] = {
val toCharset = charset.toString
- if (input.numBytes == 0 || "UTF-8".equalsIgnoreCase(toCharset)) {
+ if (input.numBytes == 0 || ("UTF-8".equalsIgnoreCase(toCharset) &&
input.isValid())) {
Review Comment:
I can't create a 'failed case before or after this PR. Invalid inputs do not
always generate errors, but a re-mapped byte array. It's tricky for me to find
a specific case to test `CharacterCodingException`
--
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]