0dunay0 commented on code in PR #10601:
URL: https://github.com/apache/paimon/pull/10601#discussion_r4320958675
##########
paimon-format/src/test/java/org/apache/paimon/format/parquet/ParquetFormatReadWriteTest.java:
##########
@@ -667,4 +672,85 @@ public void
testMissingDottedTopLevelFieldWithNoCollisionIsStillPushedDown()
.as("every row must survive: `x.y` is simply absent, with
nothing to collide with")
.containsExactlyInAnyOrder(1L, 2L);
}
+
+ @Test
+ public void testIcebergTimestampMicros() throws Exception {
+ Options options = new Options();
+ options.set("metadata.iceberg.storage", "table-location");
+ ParquetFileFormat format =
+ new ParquetFileFormat(new
FileFormatFactory.FormatContext(options, 1024, 1024));
+ RowType rowType =
+ RowType.builder()
+ .field("local_timestamp", DataTypes.TIMESTAMP(3))
+ .field("utc_timestamp",
DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE(3))
+ .build();
+ Timestamp min = Timestamp.fromEpochMillis(1691827200123L);
+ Timestamp max = Timestamp.fromEpochMillis(1691827200456L);
+
+ // repeated values, so that the columns are dictionary encoded
+ write(
+ format.createWriterFactory(rowType),
+ file,
+ GenericRow.of(min, min),
+ GenericRow.of(max, max),
+ GenericRow.of(min, min));
+
+ // Iceberg requires MICROS for timestamptz, timestamp without time
zone is unchanged
+ try (ParquetFileReader reader =
+ ParquetUtil.getParquetReader(
+ fileIO, file, fileIO.getFileSize(file), new
Options())) {
+ MessageType schema =
reader.getFooter().getFileMetaData().getSchema();
+
Assertions.assertThat(schema.getType("local_timestamp").getLogicalTypeAnnotation())
+ .isEqualTo(
+ LogicalTypeAnnotation.timestampType(
+ false,
LogicalTypeAnnotation.TimeUnit.MILLIS));
Review Comment:
When metadata.iceberg.storage is not disabled, `TIMESTAMP(<=3)` is now
written as `TIMESTAMP_MICROS`, the same as `TIMESTAMP_LTZ(<=3)`. The
non-Iceberg default is unchanged.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]