stevomitric commented on code in PR #45421:
URL: https://github.com/apache/spark/pull/45421#discussion_r1518576388


##########
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java:
##########
@@ -410,7 +414,19 @@ public boolean endsWith(final UTF8String suffix, int 
collationId) {
     if (collationId == CollationFactory.LOWERCASE_COLLATION_ID) {
       return this.toLowerCase().endsWith(suffix.toLowerCase());
     }
-    return matchAt(suffix, numBytes - suffix.numBytes, collationId);
+    return collatedEndsWith(suffix, collationId);
+  }
+
+  private boolean collatedEndsWith(final UTF8String suffix, int collationId) {
+    if (suffix.numBytes == 0 || this.numBytes == 0) {
+      return suffix.numBytes==0;
+    }
+    if (suffix.numChars() > this.numChars()) {
+      return false;
+    }
+    return CollationFactory.getStringSearch(
+            this.substring(this.numChars()-suffix.numChars(), this.numChars()),

Review Comment:
   > identation is a bit weird here. 4 spaces should be more appropriate? 
Please align with the rest of file.
   
   Followed [Spacing and Indention 
rules](https://github.com/databricks/scala-style-guide?tab=readme-ov-file#spacing-and-indentation).
   



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