Repository navigation
fix(common): skip all-null inputs when merging min/max - #26750
Open
mikamikasuki wants to merge 1 commit into
Open
mikamikasuki wants to merge 1 commit into
mikamikasuki wants to merge 1 commit into
Conversation
Generated-by: OpenAI Codex
mikamikasuki
marked this pull request as ready for review
October 25, 2026 19:59
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.
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.``