Skip to content

fix(backport): account for grouped aggregate memory - #16

Open
discord9 wants to merge 1 commit into
GreptimeTeam:greptimedb-53.1.0-function-signature-exec-errorfrom
discord9:fix/qp-024-grouped-accumulator-memory
Open

fix(backport): account for grouped aggregate memory#16
discord9 wants to merge 1 commit into
GreptimeTeam:greptimedb-53.1.0-function-signature-exec-errorfrom
discord9:fix/qp-024-grouped-accumulator-memory

Conversation

@discord9

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

Grouped AVG and MEDIAN accumulators under-report their owned state on the GreptimeDB DataFusion 53.1 fork. Under constrained query memory, this can delay spill or rejection and allow high-cardinality aggregation to exceed the intended memory budget.

What changes are included in this PR?

  • Account for grouped AVG vector headers, native sum storage, count storage, and null-state allocation.
  • Account for grouped MEDIAN native value storage, inner vector allocations, and the outer vector header/allocation.
  • Add focused regression tests that compare the reported size with all owned accumulator state, including AVG null-state allocation and empty/populated MEDIAN state.

No public API or dependency changes are included.

Are these changes tested?

Using the lane sccache configuration:

  • cargo fmt --all -- --check
  • git diff --check
  • cargo test -p datafusion-functions-aggregate --lib test_groups_accumulator_size_accounts_for_owned_state (2 passed, 0 failed)

The pre-fix Greptime harness independently reproduced the accounting gap in two four-attempt runs: AVG reported 512 bytes versus 1072 bytes of owned state, and MEDIAN reported 96 bytes versus 1096 bytes.

Are there any user-facing changes?

Yes. Query memory accounting for grouped AVG and MEDIAN now includes all owned accumulator state, allowing existing memory limits and spill/rejection mechanisms to react at the correct threshold. There are no API changes.

Backport the grouped AVG and MEDIAN accumulator memory accounting fix from upstream DataFusion commit 73d5d78.

Signed-off-by: discord9 <discord9@163.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant