Ritesh17rb opened a new pull request, #410:
URL: https://github.com/apache/datafusion-spark/pull/410

   ## Which issue does this PR close?
   
   - Fixes the reported literal and column cases in #364.
   
   ## Rationale for this change
   
   `struct(1, 2, 3)` returns `c0`, `c1`, and `c2` instead of Spark's `col1`, 
`col2`, and `col3`. `struct(a)` should retain the column name `a`.
   
   ## What changes are included in this PR?
   
   Register a Spark `struct` and plan SQL struct expressions with column, 
nested-field, and alias names captured before optimization. Other arguments use 
one-based `colN` names. The physical implementation retains child nullability 
and metadata and handles scalar/column inputs and empty structs.
   
   Merge nested nullability during array coercion, including DataFusion array 
literals, to prevent arrays of structs with NULL fields from panicking.
   
   Two SQL parser limits remain documented with deferred Spark expectations in 
`struct.slt`: mixed aliased/unnamed arguments already have `cN` names before 
`ExprPlanner`, indistinguishable from explicit `AS cN`, and `struct()` is 
rejected before planning. Preserve explicit aliases rather than guessing which 
names were generated. Empty structs work through the Rust/physical APIs.
   
   ## Are these changes tested?
   
   Yes, in `struct/struct.slt` and the existing map tests. Coverage includes 
names, aliases, duplicates, nested fields, NULLs, arrays, and both ANSI 
settings. Rust tests check metadata, nullability, broadcasting, and empty 
batches/structs.
   
   Checked with the repository PySpark runner on Spark 4.2.0. All 19 active 
struct records and both updated map records pass. Existing unrelated map skips 
and expected failures remain.
   
   ## Are there any user-facing changes?
   
   Unaliased `struct` calls with arguments now use Spark's field names and 
retain column names.
   


-- 
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