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



##########
File path: 
spark/v3.2/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java
##########
@@ -598,7 +598,8 @@ 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);
+        // produce a literal value that Spark can parse
+        return lit.toString();

Review comment:
       No, we should not rely on `toString` using a representation that works 
for Spark. Instead, this should convert the literal for Spark here. We may 
change the toString representation in `Literal` and we don't want this to 
depend on that method. It's fine for numbers, but there are different 
representations for binary that are equally valid. This is where we customize 
the one that Spark uses.




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