You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dbatomic (via GitHub)" <gi...@apache.org> on 2024/03/08 16:44:56 UTC

Re: [PR] [SPARK-47295][SQL][COLLATION] Added ICU StringSearch for 'startsWith' and 'endsWith' functions [spark]

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


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

Review Comment:
   nit: space around ==



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org