Rich-T-kid commented on code in PR #23193:
URL: https://github.com/apache/datafusion/pull/23193#discussion_r3478952905
##########
datafusion/physical-expr-common/src/binary_map.rs:
##########
@@ -476,6 +480,84 @@ where
}
}
+ /// Emits the next `n` distinct values as an Arrow array.
+ ///
+ /// The builder is frozen into an immutable `Buffer` (zero-copy) and the
+ /// emitted window is sliced from it directly (zero-copy). Only the
+ /// surviving bytes are copied back into a fresh builder, so the insertion
+ /// path is unchanged.
+ ///
+ /// Panics if `n` exceeds the number of not-yet-emitted values.
+ pub fn emit(&mut self, n: usize) -> ArrayRef {
+ let total = self.offsets.len() - 1;
+ let remaining = total - self.emitted;
+ assert!(n <= remaining, "emit({n}): only {remaining} values remain");
Review Comment:
Honestly not sure when to return a panic as opposed to just clamping down on
`n`. I think it's fair to make the caller responsible for passing in a correct
`n`. Im open to ideas against this
--
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]