refactor(parquet): split opener.rs into a module#22156
Draft
adriangb wants to merge 1 commit into
Draft
Conversation
Contributor
|
We could potentially split this into module moves too |
Convert `opener.rs` (~2,700 LOC) into an `opener/` module with two sibling files extracted from the state machine: - `opener/early_stop.rs` — `EarlyStoppingStream`, the dynamic-filter early-termination wrapper used at the end of `build_stream`. Pure code motion. - `opener/encryption.rs` — `EncryptionContext` and the `ParquetMorselizer::get_encryption_context` helpers. Isolates the `#[cfg(feature = "parquet_encryption")]` gating that previously bled through the main file. No public API change, no behavior change. The state machine and all pruning logic stay in `opener/mod.rs`.
b044e05 to
3efc367
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Relates to the discussion in #22024 about the Parquet opener becoming a tangled state machine. Does not close that issue — this is a small, mechanical step that makes future hook/extension work easier.
Rationale for this change
opener.rsis ~2,700 LOC on main, and several pieces in it have nothing to do with the open-file state machine — they're self-contained types sharing a file with their caller. Moving them to siblings drops the cognitive cost of reading the state machine without changing any public API or behavior.This is intentionally minimal so it can land quickly. The hook/extension trait that addresses #22024's broader concern ("the opener is becoming a mini planner") is being prepared as a separate PR so reviewers can evaluate each change on its own merits.
What changes are included in this PR?
Module split, pure code motion:
opener.rs→opener/mod.rsopener/early_stop.rs—EarlyStoppingStream(~100 LOC), the dynamic-filter early-termination wrapper used at the end ofbuild_stream.opener/encryption.rs—EncryptionContextand theParquetMorselizer::get_encryption_contexthelpers. Isolates the#[cfg(feature = \"parquet_encryption\")]gating that previously bled through the main file.The state machine, the pruning logic, and all public APIs are unchanged.
Are these changes tested?
Yes:
datafusion-datasource-parquetunit tests pass.cargo fmt --all,./dev/rust_lint.sh,cargo clippy -p datafusion-datasource-parquet --all-targets --all-features -- -D warningsall pass.datafusioncore builds clean.Are there any user-facing changes?
No. Public API is unchanged. The renamed file is module-private. No breaking changes.