test: cover nested wrappers and TRY_CAST in physical CASE nullability#65
Merged
friendlymatthew merged 1 commit intoJul 23, 2026
Conversation
Adds unit tests that lock in two properties of unwrap_certainly_null_expr: - Nested null-preserving wrappers (e.g. CAST(-foo)) are unwrapped recursively, so the guarded branch is still proven unreachable-as-null. - TRY_CAST is intentionally NOT unwrapped: it can yield NULL on a failed cast even for a non-null input, so a guarded TRY_CAST branch keeps the CASE nullable. This guards the logical/physical sync invariant against someone later unwrapping TRY_CAST on only one side. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
friendlymatthew
approved these changes
Jul 23, 2026
friendlymatthew
merged commit Jul 23, 2026
32d3de6
into
friendlymatthew/fix-case-physical-nullability
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.
Follow-up tests for apache#23844, targeting your branch so they land in the same PR.
Two additions to
case_expression_nullability(both run for the nullable and non-nullable column variants):CAST(-foo)andNOT(NOT(predicate))confirmunwrap_certainly_null_exprrecurses through stacked null-preserving wrappers, so the guarded branch is still proven unreachable-as-null.TRY_CASTstays nullable —TRY_CASTis intentionally not unwrapped: it can yield NULL on a failed cast even for a non-null input, so a guardedTRY_CASTbranch keeps theCASEnullable. I verified this fails (assert_nullable) ifTryCastExpris added to the unwrapper, so it guards the logical/physical sync invariant against someone unwrapping it on only one side.cargo test -p datafusion-physical-expr,cargo fmt, andcargo clippy --all-targets --all-features -D warningsall pass on top of your branch.Feel free to squash into your commit or cherry-pick whatever's useful.
🤖 Generated with Claude Code