Skip to content

Encapsulate early File pruning in parquet opener in its own stream #17293

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 1 commit into from
Aug 24, 2025

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Aug 22, 2025

Which issue does this PR close?

Rationale for this change

While reviewing #16433 (see #16433 (comment))

I found this code somewhat 🤯 (and this function is already 100s of lines long) I spent some time refactoring it into its own stream for readability

What changes are included in this PR?

Extract out the early termination code into its own stream structure

Are these changes tested?

By existing tests

Are there any user-facing changes?

No, this is internal refactoring only

@github-actions github-actions bot added physical-expr Changes to the physical-expr crates datasource Changes to the datasource crate physical-plan Changes to the physical-plan crate labels Aug 22, 2025
@alamb alamb force-pushed the alamb/encapsulate_stream branch from 621bce4 to 9332bb4 Compare August 22, 2025 17:53
let files_ranges_pruned_statistics =
file_metrics.files_ranges_pruned_statistics.clone();

stream::try_unfold(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the core idea is to move this try_unfold closure into a real structure -- all the logic is the same, but I think it is easier to understand in its own, documented Stream struct

@adriangb
Copy link
Contributor

This is ready to rebase and take out of draft!

@alamb alamb force-pushed the alamb/encapsulate_stream branch from 9332bb4 to 14baad7 Compare August 22, 2025 18:40
@github-actions github-actions bot removed physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate labels Aug 22, 2025
@alamb alamb changed the title Encapsulate early pruning in its own stream Encapsulate early File pruning in parquet opener in its own stream Aug 22, 2025
)
.boxed())
} else {
Ok(stream.boxed())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is also a bit easier to understand that the pruning only happens when we have an file pruner

@alamb alamb marked this pull request as ready for review August 22, 2025 18:41
@alamb
Copy link
Contributor Author

alamb commented Aug 22, 2025

This is ready to rebase and take out of draft!

Done!

@alamb alamb requested a review from adriangb August 22, 2025 18:41
@alamb alamb merged commit fa26515 into apache:main Aug 24, 2025
28 of 29 checks passed
@alamb alamb deleted the alamb/encapsulate_stream branch August 24, 2025 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasource Changes to the datasource crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants