schenksj opened a new pull request, #4523:
URL: https://github.com/apache/datafusion-comet/pull/4523

   ## Which issue does this PR close?
   
   Closes #4432.
   
   ## Rationale for this change
   
   A field of a NULL struct must be NULL (Spark semantics). Arrow stores a 
`StructArray`'s child arrays with their own validity, **independent** of the 
parent struct's null buffer — so the raw child value at a row where the struct 
itself is null can be non-null (e.g. parquet files where a logically-null 
struct column still carries a populated child buffer). 
`GetStructField::evaluate` returned the child column verbatim, so 
`isnotnull(struct.field)` wrongly evaluated TRUE for a null struct.
   
   ## What changes are included in this PR?
   
   `GetStructField` now unions the parent struct's null mask into the extracted 
child (null where the struct is null OR the child is null), via a 
`project_field` helper used by both the array and scalar-struct evaluation 
paths.
   
   ## How are these changes tested?
   
   Added a standalone unit test `field_of_null_struct_is_null` that builds a 
`StructArray` whose child buffer is non-null at every row while the struct is 
null at some rows. The test **fails without the fix** (the field comes back 
non-null for the null-struct rows) and **passes with it**.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to