uros-db commented on code in PR #45216:
URL: https://github.com/apache/spark/pull/45216#discussion_r1502795006


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala:
##########
@@ -622,10 +646,24 @@ object StartsWithExpressionBuilder extends 
StringBinaryPredicateExpressionBuilde
   }
 }
 
-case class StartsWith(left: Expression, right: Expression) extends 
StringPredicate {
-  override def compare(l: UTF8String, r: UTF8String): Boolean = l.startsWith(r)
+case class StartsWith(left: Expression, right: Expression) extends 
StringPredicate
+  with CollationCheck {
+  override def compare(l: UTF8String, r: UTF8String): Boolean = {
+    val collationId = checkCollationIds()
+    if (CollationFactory.fetchCollation(collationId).isBinaryCollation) {
+      l.startsWith(r)

Review Comment:
   You're right. "startsWith" was the original name for the binary method (i.e. 
the only one supported at the time). Now, it would probably be best to change 
it to "startsWithBinary" (and probably "startsWithNonBinary" for the other one)



-- 
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]

Reply via email to