Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parquet: Move to ValueReader generation to a visitor #9063

Merged
merged 4 commits into from Jan 8, 2024

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented Nov 14, 2023

This will replace the switch statement that relies on the deprecated getOriginalType() with a visitor pattern of the new LogicalTypeAnnotation. OriginalType does not include support for Nanosecond precision timestamps.

@Fokko Fokko changed the title Parquet: Move to the visitor Parquet: Move to ValueReader generation to a visitor Nov 14, 2023
}

@Override
public Optional<ParquetValueReader<?>> visit(
Copy link
Contributor

Choose a reason for hiding this comment

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

is this case UTF8: return new ParquetValueReaders.StringReader(desc); being covered here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Fokko
Copy link
Contributor Author

Fokko commented Nov 30, 2023

@aokolnychyi do you have a spare cycle for reviewing this?

@Fokko Fokko requested a review from rdblue December 5, 2023 16:46
Copy link
Contributor

@jacobmarble jacobmarble left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

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

I think there's just a bug in the visit(timestampLogicalType) case, but everything else looks great to me. This does lead me to wonder though, do the parquet reader tests test all these data types?

I'll double check that. We don't need to need to couple any of those in this PR though.

return tsMicrosType.shouldAdjustToUTC()
? Optional.of(new TimestamptzReader(desc))
: Optional.of(new TimestampReader(desc));
} else if (timestampLogicalType.getUnit() == LogicalTypeAnnotation.TimeUnit.MICROS) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be == LogicalTypeAnnotation.TimeUnit.MILLIS? Not Micros

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oof, that's a good one! I would this part to be thoroughly tested as well.

@Fokko Fokko merged commit 13e1965 into apache:main Jan 8, 2024
41 checks passed
@Fokko Fokko deleted the fd-move-to-visitor branch January 8, 2024 19:40
@Fokko
Copy link
Contributor Author

Fokko commented Jan 8, 2024

Thanks @jacobmarble, @nk1506 & @amogh-jahagirdar for the review 🙌

geruh pushed a commit to geruh/iceberg that referenced this pull request Jan 26, 2024
* Parquet: Move to the visitor

* Add one more edge case

* Thanks Amogh!
adnanhemani pushed a commit to adnanhemani/iceberg that referenced this pull request Jan 30, 2024
* Parquet: Move to the visitor

* Add one more edge case

* Thanks Amogh!
devangjhabakh pushed a commit to cdouglas/iceberg that referenced this pull request Apr 22, 2024
* Parquet: Move to the visitor

* Add one more edge case

* Thanks Amogh!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants