cloud-fan commented on code in PR #49555:
URL: https://github.com/apache/spark/pull/49555#discussion_r1923350962


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/expressions/expressions.scala:
##########
@@ -388,12 +388,13 @@ private[sql] object HoursTransform {
 }
 
 private[sql] final case class LiteralValue[T](value: T, dataType: DataType) 
extends Literal[T] {
-  override def toString: String = {
-    if (dataType.isInstanceOf[StringType]) {
-      s"'${StringUtils.replace(s"$value", "'", "''")}'"
-    } else {
-      s"$value"
-    }
+  override def toString: String = dataType match {
+    case StringType => s"'${StringUtils.replace(s"$value", "'", "''")}'"
+    case BinaryType =>
+      assert(value.isInstanceOf[Array[Byte]])
+      val bytes = value.asInstanceOf[Array[Byte]]
+      bytes.map("%02X".format(_)).mkString("X'", "", "'")

Review Comment:
   where else do we use `encodeHexString`?



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

Reply via email to