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

Allow reading Parquet maps that lack a values field #6730

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

etseidl
Copy link
Contributor

@etseidl etseidl commented Nov 13, 2024

Which issue does this PR close?

Closes #1642.

Rationale for this change

The Parquet spec does not require the values field of a map to be present, but current readers will error out if this field is missing.

What changes are included in this PR?

Changes both the record reader and arrow reader to read a MAP lacking values as a list of keys. This matches the behavior of arrow-cpp.

Are there any user-facing changes?

No

@github-actions github-actions bot added the parquet Changes to the parquet crate label Nov 13, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

This looks good to me @etseidl -- thanky ou

I also poked around in https://github.com/apache/parquet-testing/tree/master/data for an example of such a file, but it seems like we do not have one.

cc @sunchao @tustvold in case you would like to review

let out = reader.next().unwrap().unwrap();
assert_eq!(out.num_rows(), 3);
assert_eq!(out.num_columns(), 2);
// map and list columns should now be equivalent
Copy link
Contributor

Choose a reason for hiding this comment

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

So this means the parquet reader will read MAP without values as an ListArray -- I think this seems like the intention so 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because an arrow map must have non-null values IIUC.

@etseidl
Copy link
Contributor Author

etseidl commented Nov 15, 2024

I also poked around in https://github.com/apache/parquet-testing/tree/master/data for an example of such a file, but it seems like we do not have one.

Correct, which is why the effort in the tests to produce one. I'll try submitting one I have on hand to parquet-testing.

@etseidl
Copy link
Contributor Author

etseidl commented Nov 15, 2024

apache/parquet-testing#63 submitted. Maybe we can hold off on merging this to see if the test file will be accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapArray Requires Values Array
2 participants