RussellSpitzer opened a new issue #2530:
URL: https://github.com/apache/iceberg/issues/2530


   Summary: 
   Literals.from doesn't have support for creating literals from 
java.time.Instant which can be passed in Spark 3.1.1
   
   Cannot create expression literal from java.time.Instant: 2021-04-25T19:00:00Z
       at org.apache.iceberg.expressions.Literals.from(Literals.java:85)
       at 
org.apache.iceberg.expressions.UnboundPredicate.<init>(UnboundPredicate.java:40)
   
   -----
   
   Long story
   
   Reports from some users testing out Spark 3.1 which has an extremely weird 
behavior.
   
   1. Create a table with a timestamp partition key
   ```scala
   spark.sql("CREATE TABLE foo (ts timestamp) USING ICEBERG PARTITIONED BY 
(hours(ts)) LOCATION '/Users/russellspitzer/temp'")
   spark.sql("INSERT into foo VALUES (cast(\"2021-04-25T19:01:00+00:00\" as 
timestamp))")
   ```
   
   2. Query this table
   ```sql
   SELECT * from foo WHERE ts >= \"2021-04-25T19:00:00+00:00\" and ts < 
\"2021-04-25T20:00:00+00:00\"
   ```
   
   The user reported the exception I noted at the top of this issue, I attempt 
to reproduce and cannot. I then find the following matrix of behaviors.
   
   Spark 3.0.2 - spark-shell - No Issue
   Spark 3.0.2 - spark-sql - No issue
   Spark 3.1.1 - spark-shell - No issue
   Spark 3.1.1 - spark-sql  - Exception - Query Fails
   
   While i'm slightly confused as why there is a difference in parsing behavior 
between spark-shell and spark-sql in 3.1.1 I think the fix is pretty clear and 
we need to just add support for creating timestamp literals from 
java.time.Instants


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

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