Skip to content

Commit d477a2b

Browse files
authored
fix: shrink NLJ load outcome to satisfy Clippy (#25492)
## Which issue does this PR close? Minor follow-up to #25371. ## Rationale for this change Workspace Clippy fails on main (`a522cd5bcedabd6238a0462b881a7ef4cb5c6f66`) with `clippy::large_enum_variant` in `LoadOutcome`. After the segmented batch layout change, `Chunk` contains at least 201 bytes while `Empty` carries no data. Reproduced on aarch64 macOS with Rust 1.98.1: ```sh cargo clippy --workspace --all-targets --all-features -- -D warnings ``` ## What changes are included in this PR? Store `Arc<JoinLeftData>` in `LoadOutcome::Chunk`. Construct the Arc when loading completes and reuse it when publishing the chunk. The successful path already allocated this Arc during publication, so this reduces the enum size without adding another allocation or changing the shared chunk ownership. ## What is the testing strategy for this PR? The Clippy command above fails before the change and passes after it. Existing NLJ tests cover coordinated spilling, cancellation, and memory reservation lifetimes; no new behavior is introduced. Validation: - `cargo fmt --all` - `cargo clippy --workspace --all-targets --all-features -- -D warnings` - `cargo test -p datafusion-physical-plan --lib joins::nested_loop_join` (90 passed) - `cargo test --test sqllogictests -- nested_loop_join_spill` (passed) - `uv run ./dev/rust_lint.sh` (full suite passed) ## Are there any user-facing changes? No query or public API changes. This restores the workspace Clippy check.
1 parent a522cd5 commit d477a2b

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎datafusion/physical-plan/src/joins/nested_loop_join.rs‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,13 +1927,12 @@ impl FallbackCoordinator {
19271927
if is_last {
19281928
inner.left_exhausted = true;
19291929
}
1930-
let arc_data = Arc::new(data);
19311930
inner.current = Some(CurrentChunk {
19321931
chunk_index,
1933-
data: Arc::clone(&arc_data),
1932+
data: Arc::clone(&data),
19341933
is_last,
19351934
});
1936-
Some(Ok(Some((arc_data, is_last))))
1935+
Some(Ok(Some((data, is_last))))
19371936
}
19381937
Ok(LoadOutcome::Empty) => {
19391938
inner.left_exhausted = true;
@@ -2058,7 +2057,7 @@ impl FallbackCoordinator {
20582057
);
20592058

20602059
Ok(LoadOutcome::Chunk {
2061-
data,
2060+
data: Arc::new(data),
20622061
is_last: left_stream_exhausted,
20632062
carryover: next_carryover,
20642063
})
@@ -2087,7 +2086,7 @@ enum Decision<'a> {
20872086

20882087
enum LoadOutcome {
20892088
Chunk {
2090-
data: JoinLeftData,
2089+
data: Arc<JoinLeftData>,
20912090
is_last: bool,
20922091
carryover: Option<RecordBatch>,
20932092
},

0 commit comments

Comments
 (0)