Skip to content

Keep physical scalar subqueries nullable - #65

Merged
osipovartem merged 1 commit into
embucket-sync-df55.0.0from
scalar-subquery-physical-nullability
Sep 5, 2026
Merged

Keep physical scalar subqueries nullable#65
osipovartem merged 1 commit into
embucket-sync-df55.0.0from
scalar-subquery-physical-nullability

Conversation

@osipovartem

Copy link
Copy Markdown
Collaborator

Summary

  • mark the physical expression for an uncorrelated scalar subquery nullable
  • add a planner-level test whose inner projection is non-nullable

Why

The logical expression contract was corrected in #64, but physical planning independently copied nullability from the subquery's projected field. An empty scalar subquery returns NULL even when that projected field is declared non-nullable, so the physical expression must preserve the SQL-level nullable contract.

This was found by the Rustice live-Snowflake oracle for:

SELECT (SELECT column1 FROM VALUES (2) WHERE FALSE) AS scalar_empty;

Validation

  • cargo +1.97.0 test -p datafusion-physical-expr -q (1588 passed, 2 ignored; all 13 secondary tests passed)
  • cargo +1.97.0 clippy -p datafusion-physical-expr --all-targets -- -D warnings
  • cargo +1.97.0 fmt --all -- --check

@osipovartem
osipovartem merged commit a996e84 into embucket-sync-df55.0.0 Sep 5, 2026
19 checks passed
@osipovartem
osipovartem deleted the scalar-subquery-physical-nullability branch September 5, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant