Fix accumulator reset when arguments outnumber aggregates

Previously, while resetting accumulator registers, we would also
reset subsequent registers. This happened because the number of registers
to reset was computed as the sum of arguments rather than the number of
aggregate functions.
This commit is contained in:
Piotr Rzysko
2025-09-06 05:36:03 +02:00
parent 6224cdbbd3
commit 110ffba2a1
2 changed files with 19 additions and 1 deletions

View File

@@ -762,7 +762,7 @@ pub fn group_by_emit_row_phase<'a>(
program.emit_insn(Insn::Null {
dest: start_reg,
dest_end: Some(
start_reg + t_ctx.non_aggregate_expressions.len() + plan.agg_args_count() - 1,
start_reg + t_ctx.non_aggregate_expressions.len() + plan.aggregates.len() - 1,
),
});