fix: last value accumulator merge indexing - #23905
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23905 +/- ##
==========================================
- Coverage 80.67% 80.66% -0.01%
==========================================
Files 1095 1095
Lines 372416 372426 +10
Branches 372416 372426 +10
==========================================
- Hits 300434 300431 -3
- Misses 54055 54060 +5
- Partials 17927 17935 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
cc @comphead, @andygrove, tagging you because you involved in the discussion of apache/datafusion-comet#4131, please take a look if you have time, Thanks! |
|
Checking this |
comphead
left a comment
There was a problem hiding this comment.
Thanks @peterxcli the PR makes sense to me, and likely other accumulators shouldn't be affected.
For the test it would be nice having another one
#[test]
fn test_trivial_last_value_merge_all_flags_false() -> Result<()> {
let mut acc = TrivialLastValueAccumulator::try_new(&DataType::Int64, false)?;
let states: Vec<ArrayRef> = vec![
Arc::new(Int64Array::from(vec![None, None])) as ArrayRef,
Arc::new(BooleanArray::from(vec![false, false])) as ArrayRef,
];
acc.merge_batch(&states)?;
assert_eq!(acc.evaluate()?, ScalarValue::Int64(None));
Ok(())
}
to test is_set flags
comphead
left a comment
There was a problem hiding this comment.
Thanks @peterxcli
Since this is a core change I'd like to keep it open to let other committers have a chance to look at it
Which issue does this PR close?
PartialMergedatafusion-comet#4131.Rationale for this change
TrivialLastValueAccumulator::merge_batchfiltered out unset states but then read row0from the remaining value array. As a result, merging multipleLAST_VALUEpartial states returned the first valid state instead of the last one.What changes are included in this PR?
LAST_VALUEstates.Are these changes tested?
Yes:
cargo test -p datafusion-functions-aggregate test_first_last_state_after_merge