Skip to content

fix(common): skip all-null inputs when merging min/max - #26750

Open
mikamikasuki wants to merge 1 commit into
apache:mainfrom
mikamikasuki:fix/26748-ignore-all-null-minmax
Open

mikamikasuki wants to merge 1 commit into
apache:mainfrom
mikamikasuki:fix/26748-ignore-all-null-minmax

Conversation

@mikamikasuki

@mikamikasuki mikamikasuki commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: OpenAI Codex

Which issue does this PR close?

Closes #26748.

Rationale for this change

A partition containing only null values has absent min/max statistics. Because precision-aware min/max merges propagate absent values, including an all-null partition can discard known bounds from other partitions and leave the combined statistics less precise.

What changes are included in this PR?

The merge skips min/max values only when exact row and null counts prove an input is all-null. The first input that may contain non-null rows initializes the bounds; later potentially non-null inputs continue through the existing precision-aware merge. Unknown null counts remain conservative.

What is the testing strategy for this PR?

Added test_try_merge_iter_ignores_all_null_inputs_for_min_max, covering all-null inputs before and after a bounded input and confirming unknown null counts still make bounds absent. The regression failed before the fix.

Validated with cargo test -p datafusion-common --lib (645 passed), rustfmt --check datafusion/common/src/stats.rs, and git diff --check.

Are there any user-facing changes?

Query statistics retain known min/max bounds when all-null partitions are merged with other partition statistics. There are no API changes.

AI assistance was used to help implement the change and draft the regression test; I reviewed and understand the submitted changes.``

@github-actions github-actions Bot added the common Related to common crate label Oct 25, 2026
@mikamikasuki
mikamikasuki marked this pull request as ready for review October 25, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip all-null inputs when merging min/max in Statistics::try_merge_iter

1 participant