Skip to content

Conversation

@rdblue
Copy link
Contributor

@rdblue rdblue commented Apr 3, 2020

Parquet 1.11.0 added logical type annotations that can be used to store Iceberg's adjustToUTC value like Avro, so that Parquet files correctly encode whether a value is a timestamp or a timestamptz.

@rdblue
Copy link
Contributor Author

rdblue commented Apr 3, 2020

@Fokko, you may be interested in this one.

Copy link
Contributor

@Fokko Fokko left a comment

Choose a reason for hiding this comment

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

Thanks @rdblue for tagging me in this one. Sorry for the late reply, still finding a new routine with the corona stuff. Hope you and your family are safe.

In this PR's we're using the LogicalTypeAnnotation Parquet 1.11.0 class, so I think we can also get rid of the constructor for Parquet 1.10 in: https://github.com/apache/incubator-iceberg/blob/master/parquet/src/main/java/org/apache/iceberg/parquet/ParquetWriter.java#L60-L64
Just to keep it nice and tidy :)

Cheers, Fokko

@rdblue rdblue requested a review from danielcweeks April 17, 2020 21:42
}

@Override
public Optional<PrimitiveWriter<?>> visit(LogicalTypeAnnotation.JsonLogicalTypeAnnotation jsonLogicalType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In Parquet, LogicalTypeAnnotation.java, there is LogicalTypeAnnotation.IntLogicalTypeAnnotation. Do we need it here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Methods that aren't implemented here use the superclass implementation, which returns Optional.empty. When that happens, we fall back to the old logic that uses just the primitive type.

Optional<PrimitiveWriter<?>> writer = logicalType.accept(new LogicalTypeWriterVisitor(desc));
if (writer.isPresent()) {
return writer.get();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

When writer.isPresent() == false, we falls back to the previous logic, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct.

@danielcweeks
Copy link
Contributor

This all looks good to me. +1

@rdblue rdblue force-pushed the use-parquet-logical-type-annotations branch from 7ff9cba to 7b8b638 Compare May 7, 2020 19:32
@rdblue
Copy link
Contributor Author

rdblue commented May 7, 2020

Thanks for reviewing, everyone!

@rdblue rdblue merged commit 1d13a10 into apache:master May 7, 2020
simonsssu pushed a commit to simonsssu/iceberg that referenced this pull request Aug 26, 2020
…ck-port apache#965 from open source. To be reverted when apache#891 is merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants