Skip to content

Commit 2df3e9a

Browse files
lyne7-scslfan1989
andauthored
[AURON #2482] handle optional sort indices for zero-column batches (#2483)
# Which issue does this PR close? Closes #2482 # Rationale for this change The primitive sort fast path changed `sorted_indices` from `Vec<u32>` to `Option<Vec<u32>>`, but the zero-column batch path still calls `len()` as if it were a `Vec`. This causes `datafusion-ext-plans` to fail compilation. # What changes are included in this PR? Use the sorted indices length when present, and fall back to the number of key rows for the primitive fast path. # Are there any user-facing changes? No. # How was this patch tested? UTs passed. # Was this patch authored or co-authored using generative AI tooling? - [x] Yes - [ ] No If yes, include: `Generated-by: <tool name and version>` ASF guidance: https://www.apache.org/legal/generative-tooling.html Co-authored-by: Shilun Fan <slfan1989@apache.org> Signed-off-by: Shilun Fan <slfan1989@apache.org>
1 parent 0ef91f7 commit 2df3e9a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

native-engine/datafusion-ext-plans/src/sort_exec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ impl ExternalSorter {
722722
take_batch(batch, sorted_indices.expect("non-fast-path indices"))?
723723
}
724724
} else {
725-
create_zero_column_batch(sorted_indices.len())
725+
create_zero_column_batch(sorted_indices.as_ref().map_or(keys.num_rows(), Vec::len))
726726
};
727727

728728
// add to in-mem blocks

0 commit comments

Comments
 (0)