maxburke commented on code in PR #23032:
URL: https://github.com/apache/datafusion/pull/23032#discussion_r3454867500
##########
datafusion/physical-plan/src/joins/utils.rs:
##########
@@ -1373,13 +1373,218 @@ pub(crate) fn build_batch_from_indices(
Ok(RecordBatch::try_new(Arc::new(schema.clone()), columns)?)
}
+/// Computes prefix-sum offsets for a sequence of build-side batches.
+///
+/// `offsets[k]` is the flat row index at which batch `k` begins in the logical
+/// concatenation of all batches, and `offsets[n]` is the total row count. This
+/// lets a flat build-side index be mapped back to a `(batch, row)` pair
without
+/// materializing the concatenation.
+pub(crate) fn build_batch_offsets(
+ batch_row_counts: impl Iterator<Item = usize>,
+) -> Vec<usize> {
+ let mut offsets = vec![0usize];
+ let mut acc = 0usize;
+ for n in batch_row_counts {
Review Comment:
I've revamped it to use collect. (It didn't zero initialize the whole vec;
it just created a vec with the first element being a zero)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]