Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ public ParquetValueReader<?> primitive(org.apache.iceberg.types.Type.PrimitiveTy
}
case TIME_MICROS:
return new TimeReader(desc);
case TIME_MILLIS:
return new TimeMillisReader(desc);
case DECIMAL:
DecimalMetadata decimal = primitive.getDecimalMetadata();
switch (primitive.getPrimitiveTypeName()) {
Expand Down Expand Up @@ -356,6 +358,17 @@ public OffsetDateTime read(OffsetDateTime reuse) {
}
}

private static class TimeMillisReader extends PrimitiveReader<LocalTime> {
private TimeMillisReader(ColumnDescriptor desc) {
super(desc);
}

@Override
public LocalTime read(LocalTime reuse) {
return LocalTime.ofNanoOfDay(column.nextLong() * 1000000L);
}
}

private static class TimeReader extends PrimitiveReader<LocalTime> {
private TimeReader(ColumnDescriptor desc) {
super(desc);
Expand Down
3 changes: 2 additions & 1 deletion data/src/test/java/org/apache/iceberg/data/DataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ public abstract class DataTest {
required(114, "dec_9_0", Types.DecimalType.of(9, 0)),
required(115, "dec_11_2", Types.DecimalType.of(11, 2)),
required(116, "dec_38_10", Types.DecimalType.of(38, 10)), // maximum precision
required(117, "time", Types.TimeType.get())
required(117, "time", Types.TimeType.get()),
required(118, "time_ms", Types.TimeType.get())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iceberg won't actually write data in milliseconds, so we would need to write a Parquet file using the annotation and confirm that a time column is correct when reading.

Can you remove this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rdblue do we have any boilerplate code I can use to do that?

);

@Rule
Expand Down