uros-db commented on code in PR #48521:
URL: https://github.com/apache/spark/pull/48521#discussion_r1815180784
##########
common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationAwareUTF8String.java:
##########
@@ -1329,7 +1467,26 @@ public static UTF8String trimRight(
String src = srcString.toValidString();
CharacterIterator target = new StringCharacterIterator(src);
Collator collator = CollationFactory.fetchCollation(collationId).collator;
- int charIndex = src.length(), longestMatchLen;
+ int charIndex = src.length(), longestMatchLen, lastNonSpacePosition =
src.length();
+
+ // In cases of trim collation (rtrim for example) trailing spaces should
be ignored.
+ // If trimString contains spaces this behaviour is not important as they
would get trimmed
+ // anyway. However, if it is not the case they should be ignored and then
appended after
+ // trimming other characters.
+ if (!trimChars.containsKey(0x20) &&
Review Comment:
let's separate out 0x20 an (int) constant
--
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]