vladimirg-db opened a new pull request, #46181: URL: https://github.com/apache/spark/pull/46181
What changes were proposed in this pull request? Added hand-crafted implementations of unicode-aware lower-case contains, startsWith, endsWith to optimize UTF8_BINARY_LCASE for ASCII-only strings. Why are the changes needed? UTF8String.toLowerCase(), which is used for the aforementioned collation-aware functions, has an optimization for full-ascii strings, but still always allocates a new object. In this PR I introduced loop-based implementations, which fall-back to toLowerCase() in case they meet a non-asci character. Does this PR introduce any user-facing change? No, these functions should behave exactly as: lhs.containsInLowerCase(rhs) == lhs.toLowerCase().contains(rhs.toLowerCase()) lhs.startsWithInLowerCase(rhs) == lhs.toLowerCase().startsWith(rhs.toLowerCase()) lhs.endsWithInLowerCase(rhs) == lhs.toLowerCase().endsWith(rhs.toLowerCase()) How was this patch tested? Added new test cases to org.apache.spark.unsafe.types.CollationSupportSuite and org.apache.spark.unsafe.types.UTF8StringSuite, including several unicode lowercase specific. Also I've run CollationBenchmark on GHA for JDK 17 and JDK 21 and have updated the data. Was this patch authored or co-authored using generative AI tooling? No -- 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]
