Refactor: Unify execute functions in zarr_exec.rs (Phase 2)#15
Merged
Conversation
Extract common patterns from execute_remote, execute_virtualizarr, and execute_virtualizarr_with_adapter into shared helpers: - build_exec_projected_schema(): Common schema projection logic - AsyncReadParams: Encapsulates common async read parameters - execute_async_read(): Generic async execution with store setup closure This consolidates the repeated stream creation pattern: 1. Build projected schema 2. Create async stream with store setup 3. Call read_zarr_async 4. Collect batches and wrap in RecordBatchStreamAdapter Impact: -17 lines (132 additions, 149 deletions) with clearer separation of concerns. Each execute function now focuses only on its unique store setup logic. Part of: #5
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.
Summary
Phase 2 of refactoring to eliminate duplicated code. This builds on Phase 1 (#13).
Note: This PR includes Phase 1 commits. After #13 is merged, this PR will auto-update to show only Phase 2 changes.
Phase 2 Changes
Extract common patterns from the three execute functions (
execute_remote,execute_virtualizarr,execute_virtualizarr_with_adapter) into shared helpers:build_exec_projected_schema()- Common schema projection logicAsyncReadParams- Encapsulates common async read parametersexecute_async_read()- Generic async execution with store setup closureThis consolidates the repeated stream creation pattern:
read_zarr_asyncRecordBatchStreamAdapterEach execute function now focuses only on its unique store setup logic.
Impact
Test plan
cargo test- All tests passcargo clippy- No warningscargo fmt- Properly formattedDepends on: #13 (Phase 1)
Part of #5