Skip to content

[AURON #2472] Fix nullable struct field null propagation - #2473

Open
lyne7-sc wants to merge 1 commit into
apache:masterfrom
lyne7-sc:fix/nullable-struct-field-null-propagation
Open

[AURON #2472] Fix nullable struct field null propagation#2473
lyne7-sc wants to merge 1 commit into
apache:masterfrom
lyne7-sc:fix/nullable-struct-field-null-propagation

Conversation

@lyne7-sc

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #2472

Rationale for this change

Auron does not propagate the parent struct's null bitmap when accessing a child field. As a result, a field of a null struct may incorrectly return a physical value such as 0 instead of null.

What changes are included in this PR?

  • Combine the parent struct and child field null bitmaps in GetIndexedFieldExpr.
  • Preserve the zero-copy path when the parent struct contains no nulls.

Are there any user-facing changes?

Bug fix only, accessing a field of a null struct now returns null, consistent with vanilla Spark.

How was this patch tested?

  • Add Rust tests covering parent and child null combinations.
  • Add a Spark Parquet E2E test for nullable struct field access.

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

  • Yes
  • No

If yes, include: Generated-by: gpt-5.6

ASF guidance: https://www.apache.org/legal/generative-tooling.html

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes incorrect null handling when extracting a child field from a nullable StructArray in the native engine: the child field now becomes null whenever the parent struct is null (matching vanilla Spark semantics), while keeping the zero-copy path when the parent struct has no nulls.

Changes:

  • Combine parent struct and child field null bitmaps in GetIndexedFieldExpr using NullBuffer::union.
  • Preserve zero-copy behavior by returning the child array directly when the parent struct has no nulls.
  • Add coverage via a Rust unit test for parent/child null propagation and a Spark Parquet E2E query test.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
native-engine/datafusion-ext-exprs/src/get_indexed_field.rs Propagates parent struct nulls to the selected child field and adds Rust unit tests for the behavior (and zero-copy path).
spark-extension-shims-spark/src/test/scala/org/apache/auron/AuronQuerySuite.scala Adds an E2E Parquet test ensuring s.child is null when s is null.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Incorrect values when accessing fields of a nullable struct

2 participants