uros-db commented on code in PR #48521:
URL: https://github.com/apache/spark/pull/48521#discussion_r1806406575


##########
common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationSupport.java:
##########
@@ -500,9 +502,12 @@ public static UTF8String exec(final UTF8String srcString) {
     }
     public static UTF8String exec(
         final UTF8String srcString,
-        final UTF8String trimString,
+        UTF8String trimString,
         final int collationId) {
       CollationFactory.Collation collation = 
CollationFactory.fetchCollation(collationId);
+      if(collation.supportsSpaceTrimming) {
+        trimString = CollationFactory.applyTrimmingPolicy(trimString, 
collationId);

Review Comment:
   note that the trimString itself is actually a set of characters, so order is 
irrelevant. this means that all of these:
   
   - `trim(..., "xy ")`
   - `trim(..., "x y")`
   - `trim(..., " xy")`
   
   should generally return exactly the same result (regardless of the 
collation, as long as they all use the same collation of course) - if the user 
wants to trim spaces, spaces should be trimmed



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