test: stabilize flaky streaming-aggregation memory test#222
Open
ghostiee-11 wants to merge 1 commit into
Open
Conversation
The tracemalloc peak of the streaming GROUP BY varies run to run (~1.2x-4x the source) because DataFusion processes partitions concurrently, so the number of in-flight partitions (and the peak) scales with the core count. A single sample right at the 4x threshold flaked intermittently across Python versions in CI. Sample the peak a few times and assert on the minimum: the best run reflects the true streaming floor (~1.5x source), while a regression that buffers the whole row set would keep every sample high, so the minimum still catches it. Threshold stays at 4x source size.
alxmrs
approved these changes
Jul 4, 2026
alxmrs
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Thanks for deflaking.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_streaming_aggregation_does_not_explodeflakes intermittently in CI (seen on Python 3.10 and 3.12 on recent PRs), always at ~124-125 MB against its 123.9 MB threshold (4 * source).Root cause: DataFusion processes partitions concurrently, so the tracemalloc peak scales with the number of in-flight partitions (and therefore the runner's core count). Locally the peak varies roughly 1.2x to 4x the source run to run, so the
4xthreshold sits inside that noise band and fails about 1 run in 3.Fix: sample the peak a few times and assert on the minimum. The best run reflects the true streaming floor (~1.5x source, stable), while a regression that buffers the whole row set would keep every sample high, so the minimum still catches it. The
4xthreshold is unchanged.Verified: min-of-3 stayed at or below 1.92x across 25 local stress trials (vs the
4xthreshold), and the test passes.