Skip to content

TableProvider to skip files in the folder which non relevant to selected reader #16487

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

Merged
merged 7 commits into from
Jun 24, 2025

Conversation

comphead
Copy link
Contributor

@comphead comphead commented Jun 20, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) datasource Changes to the datasource crate labels Jun 20, 2025
@comphead comphead changed the title Dev WIP: Datafusion to skip non parquet files for parquet reader Jun 20, 2025
@comphead comphead marked this pull request as ready for review June 24, 2025 00:15
@comphead comphead changed the title WIP: Datafusion to skip non parquet files for parquet reader TableProvider to skip files in the folder which non relevant to selected reader Jun 24, 2025
@@ -125,6 +125,13 @@ impl TableProviderFactory for ListingTableFactory {
// specifically for parquet file format.
// See: https://github.com/apache/datafusion/issues/7317
None => {
// if the folder then rewrite a file path as 'path/*.parquet'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is an actual fix

Copy link
Contributor

Choose a reason for hiding this comment

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

This will mean a directory of files like foo/my_file.parquet.snappy would not be readable anymore -- I think that spark creates files like my_file.snappy.parquet so it should be ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should be ok, compressed files are usually *.codec.parquet and more broad wildcard *.parquet should read them. My local test I did against part-00000-9b95f137-d11f-44b6-84b7-d49c95bc7c5b-c000.snappy.parquet

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 makes sense to me -- thank you @comphead

cc @hendrikmakait

@@ -125,6 +125,13 @@ impl TableProviderFactory for ListingTableFactory {
// specifically for parquet file format.
// See: https://github.com/apache/datafusion/issues/7317
None => {
// if the folder then rewrite a file path as 'path/*.parquet'
Copy link
Contributor

Choose a reason for hiding this comment

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

This will mean a directory of files like foo/my_file.parquet.snappy would not be readable anymore -- I think that spark creates files like my_file.snappy.parquet so it should be ok

@comphead comphead merged commit 59143c1 into apache:main Jun 24, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate datasource Changes to the datasource crate sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make datafusion read parquet folders if non parquet files exists
2 participants