yaooqinn commented on code in PR #46133:
URL: https://github.com/apache/spark/pull/46133#discussion_r1572038458
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala:
##########
@@ -414,3 +413,24 @@ trait ToStringBase { self: UnaryExpression with
TimeZoneAwareExpression =>
""".stripMargin
}
}
+
+object ToStringBase {
+ type BinaryFormatter = Array[Byte] => UTF8String
+
+ def getBinaryFormatter: BinaryFormatter = {
+ val style = SQLConf.get.getConf(SQLConf.BINARY_OUTPUT_STYLE)
+ BinaryOutputStyle.withName(style) match {
+ case BinaryOutputStyle.UTF8 =>
+ array => UTF8String.fromBytes(array)
+ case BinaryOutputStyle.BASIC => array =>
+ UTF8String.fromString(array.mkString("[", ", ", "]"))
+ case BinaryOutputStyle.BASE64 => array =>
+
UTF8String.fromString(java.util.Base64.getEncoder.withoutPadding().encodeToString(array))
Review Comment:
https://github.com/apache/hive/pull/1261/files#diff-107090e9a0306b19931b1b61f076c2a66afa7cfb1e49fea8624ef950ceb170d0R167
As we have already support hive-service-rpc 4.0.0, I added this style too
--
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]