Skip to content

Commit

Permalink
fix #1064
Browse files Browse the repository at this point in the history
  • Loading branch information
lgualtieri75 committed Feb 27, 2025
1 parent 672fe06 commit a23c51e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/vdbe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1722,6 +1722,7 @@ impl Program {
*acc += col;
}
AggFunc::Count | AggFunc::Count0 => {
let col = state.registers[*col].clone();
if matches!(&state.registers[*acc_reg], OwnedValue::Null) {
state.registers[*acc_reg] = OwnedValue::Agg(Box::new(
AggContext::Count(OwnedValue::Integer(0)),
Expand All @@ -1734,8 +1735,11 @@ impl Program {
let AggContext::Count(count) = agg.borrow_mut() else {
unreachable!();
};
*count += 1;
}

if (matches!(func, AggFunc::Count) && matches!(col, OwnedValue::Null)) == false {
*count += 1;
};
}
AggFunc::Max => {
let col = state.registers[*col].clone();
let OwnedValue::Agg(agg) = state.registers[*acc_reg].borrow_mut()
Expand Down

0 comments on commit a23c51e

Please sign in to comment.