test: end-to-end reproducer for aggregating batches with stricter nested nullability than the declared schema - #24278
Draft
alamb wants to merge 1 commit into
Draft
Conversation
…eclared schema DataFusion accepts batches whose data types are stricter than the declared schema (`MemTable::try_new` validates with `Schema::contains`, which permits a non-nullable field where the schema declares a nullable one, including nested fields). Aggregating a struct column from such batches fails in several independent places; see apache#24069. The new tests register a `MemTable` whose declared schema marks a nested struct field nullable while the batches carry a non-nullable one, and run `array_agg` / `array_agg(DISTINCT)` over it via SQL, with and without a memory limit that forces spilling. They currently fail (this commit is the reproducer only): * `array_agg`, with and without spilling: panic in `ListArray::new` (`ArrayAggGroupsAccumulator::evaluate` builds the list item field from the planner-declared type, the values from the actual data) * `array_agg(DISTINCT)` without spilling: `RowConverter column schema mismatch` (the `single_distinct_to_groupby` rewrite turns the struct into a GROUP BY key; `GroupValues`' row converter is built from the declared schema but fed the stricter runtime arrays) * `array_agg(DISTINCT)` with spilling passes on current main, showing how configuration-dependent the failures are Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
alamb
force-pushed
the
repro-24069-nested-nullability
branch
from
August 11, 2026 19:07
7b0e9b6 to
6a5d04f
Compare
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.
Which issue does this PR close?
GroupedHashAggregateStream::emitthrows ArrowError: column types must match schema types #24069 (reproducer only; the tests fail onmainby design, so this does not close the issue).Rationale for this change
get a reproducer so we can tell when the error happened
What changes are included in this PR?
An end-to-end reproducer as a basis for working out a root-cause fix.
Are these changes tested?
The tests are the change. They currently fail (and one panics) on
main, demonstrating the bug.cargo test --test core_integration -- nested_nullabilityAnd it fails like this
I also ran the same test on the 54.1.0 branch:
And it fails the same way
Are there any user-facing changes?
No.