stefankandic commented on code in PR #45725:
URL: https://github.com/apache/spark/pull/45725#discussion_r1544715571
##########
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java:
##########
@@ -863,6 +914,70 @@ private int rfind(UTF8String str, int start) {
return -1;
}
+ /**
+ * Find the `str` from right to left considering different collations.
+ */
+ private int rfind(UTF8String str, int start, int collationId) {
+ if (CollationFactory.fetchCollation(collationId).supportsBinaryEquality) {
+ return this.rfind(str, start);
+ }
+ if(collationId == CollationFactory.UTF8_BINARY_LCASE_COLLATION_ID) {
+ return rfindLowercase(str, start);
+ }
+ return collatedRFind(str, start, collationId);
+ }
+
+ /**
+ * Find the `str` from left to right considering binary lowercase collation.
+ */
+ private int rfindLowercase(UTF8String str, int start) {
Review Comment:
i know that the collation is called UTF8_BINARY_LCASE but I'm not the
biggest fan of this name as it somehow implies that it will only search for
lowercase values, how about `rfindCaseInsensitive` or `caseInsensitiveRFind`
instead?
--
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]