stevenzwu commented on code in PR #11775:
URL: https://github.com/apache/iceberg/pull/11775#discussion_r2116626909


##########
api/src/main/java/org/apache/iceberg/expressions/Literals.java:
##########
@@ -300,8 +300,7 @@ public <T> Literal<T> to(Type type) {
         case TIMESTAMP:
           return (Literal<T>) new TimestampLiteral(value());
         case TIMESTAMP_NANO:
-          // assume micros and convert to nanos to match the behavior in the 
timestamp case above
-          return new TimestampLiteral(value()).to(type);
+          return (Literal<T>) new TimestampNanoLiteral(value());

Review Comment:
   @rdblue should we expose `TimestampLiteral` and `TimestampNanoLiteral` as 
public classes? They extend from `LongLiteral`. When a engine convert its 
expression to an Iceberg expression, it pass in those specific timestamp 
literals objects (instead of the base `LongLiteral`) where precision is up to 
interpret. 
   
   E.g., spark have those SQL functions. They are explicit about the timestamp 
precision. When Spark convert the literals to Iceberg expression, they should 
be `TimestampLiteral` or `TimestampNanoLiteral`.
   ```
   ts < TIMESTAMP '2021-06-30T02:00:00.000Z'
   ts < timestamp_micros(1230219000123123)
   ts < timestamp_millis(1230219000123123)
   ```



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

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