joao-parana opened a new issue, #6164:
URL: https://github.com/apache/iceberg/issues/6164

   ### Apache Iceberg version
   
   1.0.0 (latest release)
   
   ### Query engine
   
   _No response_
   
   ### Please describe the bug 🐞
   
   The `Literals` class of the `org.apache.iceberg.expressions` package does 
not handle literals of type `LocalDateTime`.
   
   
https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/expressions/Literals.java#L59
   
   So a predicate like the one below, in a filter in a Java program, generates 
an error.
   
   ```java
   LocalDateTime beginInterval = getLocalDateTimeFromSecondsEpoch(1668023502L);
   LocalDateTime endInterval = getLocalDateTimeFromSecondsEpoch(1669668837L);
   Expression predicate = Expressions.and(
           Expressions.greaterThanOrEqual("ts", beginInterval),
           Expressions.lessThanOrEqual("ts", endInterval)
   );
   ```
   
   Error: 
   ```text
   java.lang.IllegalArgumentException: Cannot create expression literal from 
java.time.LocalDateTime: 2022-11-09T20:19:30.023502
        at org.apache.iceberg.expressions.Literals.from(Literals.java:86)
   ```
   
   `ts` is an attribute of type `Types.TimestampType.withoutZone()` in my 
**Schema**.
   
   
   ```java
   Schema schema = new Schema(
                   required(1, "ts", Types.TimestampType.withoutZone()),
                   . . .
   );
   ```
   
   Is there another way to specify a predicate to select data in a given time 
interval? The question concerns Iceberg's Java API (modules: api, core, data).
   
   **Note**: I am using type `Types.TimestampType.withoutZone()` to allow 
partitioning the table using the `month("ts")` transform function.
   
   


-- 
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-unsubscr...@iceberg.apache.org.apache.org

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


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

Reply via email to