Skip to content

test: sample current-process RSS before query execution - #26208

Closed
VVKot wants to merge 2 commits into
apache:mainfrom
VVKot:vkot/steal-polars2-rss-sampler
Closed

VVKot wants to merge 2 commits into
apache:mainfrom
VVKot:vkot/steal-polars2-rss-sampler

Conversation

@VVKot

@VVKot VVKot commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Local reproduction of a zero-RSS memory-validation failure. Depends on the window-expression lint prerequisite: #26207.

Rationale for this change

A short query can finish before the asynchronous RSS monitor starts, leaving max_rss at zero and failing the memory-limit validation. System::new_all also gathers information unrelated to the current process.

What changes are included in this PR?

Capture current-process memory before running the query, initialize the maximum from that sample, and reuse the same System in the monitor. Both refreshes exclude task enumeration. Memory thresholds are unchanged.

What is the testing strategy for this PR?

The previously failing sort_with_mem_limit_1_runner now passes. The existing memory_limit_validation_runner_works_runner still rejects its impossible 20 MB cap. The core integration suite passed 1,227 tests with one ignored. The extended workspace run is in progress.

Are there any user-facing changes?

None; this changes test infrastructure.

AI-assisted contribution authored with Codex.

@github-actions github-actions Bot added optimizer Optimizer rules core Core DataFusion crate labels Oct 11, 2026
@VVKot VVKot closed this Oct 11, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.80%. Comparing base (75ddead) to head (f15043c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26208      +/-   ##
==========================================
- Coverage   82.80%   82.80%   -0.01%     
==========================================
  Files        1149     1149              
  Lines      452205   452205              
  Branches   452205   452205              
==========================================
- Hits       374458   374448      -10     
- Misses      54950    54958       +8     
- Partials    22797    22799       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

kosiew pushed a commit to kosiew/datafusion that referenced this pull request Oct 28, 2026
)

## Which issue does this PR close?

Closes apache#26444.

## Rationale for this change

Repeated identical NaN keys can form separate TopK groups, and evicting
a NaN group can panic. Valid `GROUP BY ... ORDER BY ... LIMIT` queries
can therefore return incorrect results or fail.

## What changes are included in this PR?

- Compare primitive grouping keys with Arrow equality so identical NaN
payloads match.
- Normalize signed zero with `HashValue::normalize_key`, consistent with
ordinary grouping while preserving distinct NaN payloads.
- Remove occupied entries by their known store index during eviction and
NULL aggregate transitions.

A separate prerequisite commit retains the RSS sampling fix from apache#26208.
It samples the current process before query execution so short queries
cannot leave the recorded maximum at zero. Memory thresholds are
unchanged.

## What is the testing strategy for this PR?

The SQL regressions cover repeated NaN keys and eviction. At main commit
`7f493a565`, the eviction regression fails with `internal error: entered
unreachable code`; it passes with this fix. Hash-table tests cover
Float16/32/64, distinct NaN payloads, signed zero, and NULL aggregate
transitions.

Validation was rerun after merging main at `350ca7650`. The extended
workspace suite, including the migrated `extended_tests` target, full
SQL logic suite, and `cargo test --profile ci -p datafusion-cli` passed.
`cargo fmt --all`, `cargo clippy --all-targets --all-features -- -D
warnings`, and `UV_FROZEN=true uv run ./dev/rust_lint.sh` also passed.

The existing `topk_aggregate` primitive-key benchmark was run against
main at `c61fb09ac` using the unoptimized CI profile on a shared host.
Timing varied too much to draw a performance conclusion.

## Are there any user-facing changes?

Identical NaN keys form one TopK group, and evicting a NaN group
succeeds. Signed-zero grouping matches ordinary aggregation. There are
no public API changes.

AI-assisted contribution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants