rdblue commented on code in PR #12682: URL: https://github.com/apache/iceberg/pull/12682#discussion_r2056668528
########## parquet/src/main/java/org/apache/iceberg/parquet/VariantWriterBuilder.java: ########## @@ -229,19 +228,32 @@ public Optional<ParquetValueWriter<?>> visit(DateLogicalTypeAnnotation ignored) @Override public Optional<ParquetValueWriter<?>> visit(TimeLogicalTypeAnnotation time) { - // ParquetValueWriter<VariantValue> writer = - // ParquetVariantWriters.primitive(ParquetValueWriters.longs(desc), PhysicalType.TIME); - return Optional.empty(); + ParquetValueWriter<VariantValue> writer = + ParquetVariantWriters.primitive(ParquetValueWriters.longs(desc), PhysicalType.TIMENTZ); + return Optional.of(writer); } @Override public Optional<ParquetValueWriter<?>> visit(TimestampLogicalTypeAnnotation timestamp) { - if (timestamp.getUnit() == TimeUnit.MICROS) { - PhysicalType type = - timestamp.isAdjustedToUTC() ? PhysicalType.TIMESTAMPTZ : PhysicalType.TIMESTAMPNTZ; - ParquetValueWriter<?> writer = - ParquetVariantWriters.primitive(ParquetValueWriters.longs(desc), type); - return Optional.of(writer); + switch (timestamp.getUnit()) { Review Comment: I think this would be cleaner if you refactored the `PhysicalType` into its own method: ```java private PhysicalType type(TimestampLogicalTypeAnnotation timestamp) { switch (timestamp.getUnit()) { case MICROS: return timestamp.isAdjustedToUTC() ? PhysicalType.TIMESTAMPTZ : PhysicalType.TIMESTAMPNTZ; case NANOS: return timestamp.isAdjustedToUTC() ? PhysicalType.TIMESTAMPTZ_NANOS : PhysicalType.TIMESTAMPNTZ_NANOS; default: throw new UnsupportedOperationException("Invalid unit for shredded timestamp: " + unit); } } ``` -- 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