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

Merged
merged 4 commits into from
Nov 25, 2024

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.

@alamb
Copy link
Contributor

alamb commented Nov 22, 2024

Looks like the test is in the final phases of being accepted.

Let's wait for that to complete and then we can merge this one too

@etseidl
Copy link
Contributor Author

etseidl commented Nov 22, 2024

Should the tests here be modified first to read the new file?

@alamb
Copy link
Contributor

alamb commented Nov 22, 2024

Should the tests here be modified first to read the new file?

Yes pls

@etseidl
Copy link
Contributor Author

etseidl commented Nov 22, 2024

Not sure what markdown is failing in CI.

Edit: I managed a conda env with prettier and there were no issues reported. Very puzzling (esp since there's no output beyond "this job failed"). Maybe it's just a transient thing. 🤷

@alamb
Copy link
Contributor

alamb commented Nov 23, 2024

Not sure what markdown is failing in CI.

Edit: I managed a conda env with prettier and there were no issues reported. Very puzzling (esp since there's no output beyond "this job failed"). Maybe it's just a transient thing. 🤷

I retriggered the job -- I bet it was some sort of github infrastructure blip

@tustvold tustvold merged commit 5d992a3 into apache:main Nov 25, 2024
16 checks passed
@etseidl etseidl deleted the map_no_value branch November 25, 2024 23:54
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
3 participants