stefankandic commented on code in PR #45725:
URL: https://github.com/apache/spark/pull/45725#discussion_r1544713454
##########
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) {
+ if(numBytes == 0 || str.numBytes == 0) {
Review Comment:
this seems to have a different behaviour compared to regular rfind which
would fail if the number of bytes is zero, right?
--
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]