cloud-fan commented on code in PR #45216: URL: https://github.com/apache/spark/pull/45216#discussion_r1506048114
########## common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java: ########## @@ -355,14 +371,43 @@ public boolean matchAt(final UTF8String s, int pos) { return ByteArrayMethods.arrayEquals(base, offset + pos, s.base, s.offset, s.numBytes); } + private boolean matchAt(final UTF8String s, int pos, int collationId) { + if (s.numBytes + pos > numBytes || pos < 0) { + return false; + } + return this.substring(pos, pos + s.numBytes).semanticCompare(s, collationId) == 0; + } + public boolean startsWith(final UTF8String prefix) { return matchAt(prefix, 0); } + public boolean startsWith(final UTF8String prefix, int collationId) { + if (CollationFactory.fetchCollation(collationId).isBinaryCollation) { + return this.startsWith(prefix); + } + if (collationId == CollationFactory.LOWERCASE_COLLATION_ID) { + return this.toLowerCase().startsWith(prefix.toLowerCase()); + } + // ICU collation support Review Comment: is this a TODO? -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org