HyukjinKwon commented on a change in pull request #34848:
URL: https://github.com/apache/spark/pull/34848#discussion_r782697510



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
##########
@@ -450,16 +451,32 @@ case class Lower(child: Expression)
   override protected def withNewChildInternal(newChild: Expression): Lower = 
copy(child = newChild)
 }
 
-/** A base trait for functions that compare two strings, returning a boolean. 
*/
-abstract class StringPredicate extends BinaryExpression
+/** A base trait for functions that compare two strings or binaries, returning 
a boolean. */
+abstract class BinaryPredicate extends BinaryExpression
   with Predicate with ImplicitCastInputTypes with NullIntolerant {
 
-  def compare(l: UTF8String, r: UTF8String): Boolean
+  def compare(l: Array[Byte], r: Array[Byte]): Boolean
 
-  override def inputTypes: Seq[DataType] = Seq(StringType, StringType)
+  override def inputTypes: Seq[AbstractDataType] =
+    Seq(TypeCollection(StringType, BinaryType), TypeCollection(StringType, 
BinaryType))
+
+  def convertData(dataType: DataType): Any => Array[Byte] = dataType match {
+    case BinaryType => (input: Any) => input.asInstanceOf[Array[Byte]]
+    case StringType => (input: Any) => input.asInstanceOf[UTF8String].getBytes

Review comment:
       @AngersZhuuuu do you know if other DBMSes support this?




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