epgif commented on code in PR #9008:
URL: https://github.com/apache/iceberg/pull/9008#discussion_r1539852804


##########
api/src/main/java/org/apache/iceberg/expressions/Literals.java:
##########
@@ -426,23 +427,55 @@ protected Type.TypeID typeId() {
   }
 
   static class TimestampLiteral extends ComparableLiteral<Long> {
-    TimestampLiteral(Long value) {
+    private final TimestampType.Unit unit;
+
+    TimestampLiteral(TimestampType.Unit unit, Long value) {
       super(value);
+      this.unit = unit;
     }
 
     @Override
     @SuppressWarnings("unchecked")
     public <T> Literal<T> to(Type type) {
       switch (type.typeId()) {
         case TIMESTAMP:
-          return (Literal<T>) this;
+          TimestampType.Unit toUnit = ((TimestampType) type).unit();

Review Comment:
   Done.



##########
api/src/main/java/org/apache/iceberg/util/DateTimeUtil.java:
##########
@@ -106,11 +146,27 @@ public static String microsToIsoTimestamptz(long micros) {
     return localDateTime.atOffset(ZoneOffset.UTC).format(zeroOffsetFormatter);
   }
 
+  public static String nanosToIsoTimestamptz(long nanos) {
+    LocalDateTime localDateTime = timestampFromNanos(nanos);
+    DateTimeFormatter zeroOffsetFormatter =
+        new DateTimeFormatterBuilder()
+            .parseCaseInsensitive()
+            .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
+            .appendOffset("+HH:MM:ss", "+00:00")
+            .toFormatter();

Review Comment:
   Done.



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