Skip to content

GH-47728: [Python] Check the source argument in parquet.read_table - #48008

Merged
raulcd merged 7 commits into
apache:mainfrom
rmnskb:gh-47728-check-source-pq-read
Nov 14, 2025
Merged

raulcd merged 7 commits into
apache:mainfrom
rmnskb:gh-47728-check-source-pq-read

Conversation

@rmnskb

@rmnskb rmnskb commented Oct 30, 2025 •

Copy link
Copy Markdown
Contributor

Rationale for this change

See #47728. Check source argument in pyarrow.parquet.read_table if pyarrow.dataset is not available.

What changes are included in this PR?

Check the source argument, raise ValueError if the source argument is either a list of .parquet files or a directory.

Are these changes tested?

Yes

Are there any user-facing changes?

No

In case if the source argument is a directory, I decided not to check it directly, but to catch the exceptions coming from the fs.open_input_file, since it already checks for it, and add extra exception on top of the stack that explains the actual reason.

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this!

Comment thread python/pyarrow/parquet/core.py Resolved
Comment thread python/pyarrow/parquet/core.py Resolved

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The test failure test_read_table_without_dataset failing on the CI jobs is related. It seems a test that was using a MockDataset with a non-existing file is failing with this change, we might have to revisit that test.

@rmnskb

rmnskb commented Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

The test failure test_read_table_without_dataset failing on the CI jobs is related. It seems a test that was using a MockDataset with a non-existing file is failing with this change, we might have to revisit that test.

Yep, you're right, I've updated it with the new ValueError.

@AlenkaF AlenkaF left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for another contribution @rmnskb!
LGTM. I just added minor styling suggestions.

Comment thread python/pyarrow/parquet/core.py Resolved
Comment thread python/pyarrow/parquet/core.py Resolved
@rmnskb
rmnskb requested a review from raulcd November 12, 2025 21:11

@raulcd raulcd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, just a comment about a possible follow up issue.

@conbench-apache-arrow

Copy link
Copy Markdown

After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 46b033f.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants