You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/13 23:09:22 UTC

[GitHub] [iceberg] kbendick commented on a change in pull request #3728: Spark: adds the ability to parse iceberg hexadecimal text

kbendick commented on a change in pull request #3728:
URL: https://github.com/apache/iceberg/pull/3728#discussion_r768192493



##########
File path: spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java
##########
@@ -596,7 +596,7 @@ private static String sqlString(org.apache.iceberg.expressions.Literal<?> lit) {
       if (lit.value() instanceof String) {
         return "'" + lit.value() + "'";
       } else if (lit.value() instanceof ByteBuffer) {
-        throw new IllegalArgumentException("Cannot convert bytes to SQL literal: " + lit);
+        return lit.toString();

Review comment:
       Would these need to be quoted as SQL literals? I believe, at least with Spark, that there is a leading x followed by single quotes around the rest.
   
   Eg. when I open a spark-shell, I use the following to represent bytes.
   
   ```
   spark.sql("select x'0FA67B' as value").show
   +----------+
   |     value|
   +----------+
   |[0F A6 7B]|
   +----------+
   
   scala> spark.sql("select x'0FA67B' as value").printSchema
   root
    |-- value: binary (nullable = false)
   ```




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org