MCPcopy Create free account
hub / github.com/apache/datafusion / update_batch

Method update_batch

datafusion/functions-aggregate/src/array_agg.rs:341–367  ·  view source on GitHub ↗
(&mut self, values: &[ArrayRef])

Source from the content-addressed store, hash-verified

339
340impl Accumulator for ArrayAggAccumulator {
341 fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> {
342 // Append value like Int64Array(1,2,3)
343 if values.is_empty() {
344 return Ok(());
345 }
346
347 assert_eq_or_internal_err!(values.len(), 1, "expects single batch");
348
349 let val = &values[0];
350 let nulls = if self.ignore_nulls {
351 val.logical_nulls()
352 } else {
353 None
354 };
355
356 let val = match nulls {
357 Some(nulls) if nulls.null_count() >= val.len() => return Ok(()),
358 Some(nulls) => filter(val, &BooleanArray::new(nulls.inner().clone(), None))?,
359 None => Arc::clone(val),
360 };
361
362 if !val.is_empty() {
363 self.values.push_back(val)
364 }
365
366 Ok(())
367 }
368
369 fn merge_batch(&mut self, states: &[ArrayRef]) -> Result<()> {
370 // Append value like ListArray(Int64Array(1,2,3), Int64Array(4,5,6))

Calls 15

newFunction · 0.85
get_row_at_idxFunction · 0.85
null_countMethod · 0.80
compactedMethod · 0.80
collectMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45
innerMethod · 0.45
maxMethod · 0.45
iterMethod · 0.45
is_nullMethod · 0.45