Skip to content

Bound PGBKCVOperation precombine table by in-memory size (#39754) - #39767

Open
Dharshika-11 wants to merge 1 commit into
apache:masterfrom
Dharshika-11:fix-pgbkcv-memory-bounding
Open

Bound PGBKCVOperation precombine table by in-memory size (#39754)#39767
Dharshika-11 wants to merge 1 commit into
apache:masterfrom
Dharshika-11:fix-pgbkcv-memory-bounding

Conversation

@Dharshika-11

Copy link
Copy Markdown

Summary

This PR updates PGBKCVOperation to bound its precombine table based on estimated in-memory size in addition to the existing key-count limit.

Changes

Added an in-memory size limit using max_bytes.
PGBKCVOperation now tracks estimated memory usage through estimated_bytes and get_deep_size.
Added default memory limits:
10 MB for general accumulators.
100 MB for tiny accumulators such as Count, Mean, sum, min, and max.
The table now flushes when the estimated memory usage exceeds the configured limit, helping prevent OOM situations caused by very large accumulators.
Updated operations.pxd with the new Cython declarations:
max_bytes
estimated_bytes
_is_tiny_accumulator
Added unit tests covering:
Memory-limit-based flushing.
Existing key-count-based flushing.
Custom max_bytes and max_keys parameters.
Correct output after flushing.

Issue

Fixes #39754

@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@Dharshika-11
Dharshika-11 force-pushed the fix-pgbkcv-memory-bounding branch from 61b65ca to 9b7a27a Compare August 17, 2026 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Bound PGBKCVOperation precombine table by in-memory size, not key count

1 participant