Skip to content

[SPARK-56826][SQL] Skip PushVariantIntoScan for VariantGet with null-evaluating path#55826

Open
Shekharrajak wants to merge 1 commit into
apache:masterfrom
Shekharrajak:SPARK-56826-pushvariantintoscan-invariants
Open

[SPARK-56826][SQL] Skip PushVariantIntoScan for VariantGet with null-evaluating path#55826
Shekharrajak wants to merge 1 commit into
apache:masterfrom
Shekharrajak:SPARK-56826-pushvariantintoscan-invariants

Conversation

@Shekharrajak
Copy link
Copy Markdown

What changes were proposed in this pull request?

Add && path.eval() != null to the VariantGet case-arm guard in both collectRequestedFields and rewriteExpr in PushVariantIntoScan.

Why are the changes needed?

A VariantGet whose foldable path evaluates to null (e.g., variant_get(v, cast(null as string), 'int')) reaches PushVariantIntoScan when NullPropagation is excluded via spark.sql.optimizer.excludedRules.

Does this PR introduce any user-facing change?

No. With the default optimizer pipeline (NullPropagation enabled), VariantGet(_, Literal(null), ...) is eliminated upstream — this code path was unreachable in practice.

How was this patch tested?

New unit tests in PushVariantIntoScanV1SuiteBase

Was this patch authored or co-authored using generative AI tooling?

Yes

@Shekharrajak Shekharrajak force-pushed the SPARK-56826-pushvariantintoscan-invariants branch from 2c9da49 to c77d5f2 Compare May 12, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant