sunxiaoguang commented on code in PR #49335:
URL: https://github.com/apache/spark/pull/49335#discussion_r1910365474


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -374,6 +374,7 @@ abstract class JdbcDialect extends Serializable with 
Logging {
     case dateValue: Date => "'" + dateValue + "'"
     case dateValue: LocalDate => s"'${DateFormatter().format(dateValue)}'"
     case arrayValue: Array[Any] => arrayValue.map(compileValue).mkString(", ")
+    case binaryValue: Array[Byte] => 
binaryValue.map("%02X".format(_)).mkString("X'", "", "'")

Review Comment:
   This is actually a bug existed before.
   Array[Byte] is matched as wildcard instead of Array[Any], therefore literal 
of binary data is eventually formatted as '[B@757d6814'
   
   This fix is trying to format literal of binary data in hex format which is 
the case at least for MySQL, PostgreSQL, MS SQL Server and Spark SQL. 



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