Skip to content

Commit

Permalink
Test Count accumulator with all-nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Oct 21, 2024
1 parent 700b07f commit 1e046f5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions datafusion/functions-aggregate/src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -715,3 +715,17 @@ impl Accumulator for DistinctCountAccumulator {
}
}
}

#[cfg(test)]
mod tests {
use super::*;
use arrow::array::NullArray;

#[test]
fn count_accumulator_nulls() -> Result<()> {
let mut accumulator = CountAccumulator::new();
accumulator.update_batch(&[Arc::new(NullArray::new(10))])?;
assert_eq!(accumulator.evaluate()?, ScalarValue::Int64(Some(0)));
Ok(())
}
}

0 comments on commit 1e046f5

Please sign in to comment.