uros-db commented on code in PR #45643: URL: https://github.com/apache/spark/pull/45643#discussion_r1565524362
########## common/unsafe/src/main/java/org/apache/spark/sql/catalyst/util/CollationSupport.java: ########## @@ -169,6 +239,46 @@ private static boolean matchAt(final UTF8String target, final UTF8String pattern pos, pos + pattern.numChars()), pattern, collationId).last() == 0; } + private static int findInSet(UTF8String match, UTF8String set, int collationId) { + if (match.contains(UTF8String.fromString(","))) { + return 0; + } + + StringSearch stringSearch = CollationFactory.getStringSearch(set, match, collationId); + + String setString = set.toString(); Review Comment: I think `CollationFactory.getStringSearch(set, match, collationId)` already does `set.toString()` there's no need to do that twice, let's add: ``` public static StringSearch getStringSearch( final String targetString, final String pattern, final int collationId) { CharacterIterator target = new StringCharacterIterator(targetString); Collator collator = CollationFactory.fetchCollation(collationId).collator; return new StringSearch(pattern, target, (RuleBasedCollator) collator); } ``` to `CollationFactory` this way, we can get the stringSearch and setString instances here, without extra String allocations -- 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