Omega359 commented on code in PR #9679:
URL: https://github.com/apache/arrow-datafusion/pull/9679#discussion_r1531304375
##########
datafusion/physical-expr/src/aggregate/count_distinct/mod.rs:
##########
@@ -246,15 +255,24 @@ impl Accumulator for DistinctCountAccumulator {
})
}
+ /// Merges multiple sets of distinct values into the current set.
+ ///
+ /// The input to this function is a `ListArray` with **multiple** rows,
+ /// where each row contains the values from a partial aggregate's phase
(e.g.
+ /// the result of calling `Self::state` on multiple accumulators).
fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
if states.is_empty() {
return Ok(());
}
assert_eq!(states.len(), 1, "array_agg states must be singleton!");
let array = &states[0];
let list_array = array.as_list::<i32>();
- let inner_array = list_array.value(0);
- self.update_batch(&[inner_array])
+ for inner_array in list_array.iter() {
+ let inner_array = inner_array
+ .expect("counts are always non null, so are intermediate
results");
Review Comment:
I noticed this when updating my local repo .... is expect something that
should be used here ... my understanding that it panics on None. Given the
method returns Result I would expect err to be returned instead - am I missing
something in my understanding of Rust here?
--
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]