fix: report a non-nullable return field for named_struct() and struct() - #75
Merged
adriangb merged 1 commit intoSep 15, 2026
Conversation
Both constructors build their output `StructArray` without a null buffer, so the struct row they produce is never NULL, but they reported a nullable return field. Because `ExprSchemable::nullable` reads that field for a scalar function, the simplifier could not fold `IS NOT NULL` on them to `true`. A guard such as `WHERE s IS NOT NULL` on a struct built by a view therefore kept the whole struct expression alive, and projection pushdown could not prune the scan to the fields that are actually read. With the return field marked non-nullable the guard folds away and the scan reads only the accessed column. (cherry picked from commit a793993)
adriangb
merged commit Sep 15, 2026
fa47c12
into
friendlymatthew/pydantic-main-df55
65 of 69 checks passed
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.
Backport of apache#25306 (issue apache#25305) onto the branch the platform pins.
named_struct()andstruct()build their outputStructArraywith no null buffer but reported a nullable return field, soIS NOT NULLon a constructed struct never folded and a guard on a struct built by a view kept the whole struct alive through projection pushdown. With the return field non-nullable the guard folds totrueand the scan is pruned to the fields actually read.Cherry-picked with
-xfrom the upstream PR commit; the only conflict was thestruct.slttail, resolved by appending the new cases to this branch's version of the file. Needed by the platform change that letsmetric_*(value)read only its flat columns while keeping thevalue IS NOT NULLguard that aCASE-masked struct requires.