Phoenix500526 opened a new pull request, #26971:
URL: https://github.com/apache/datafusion/pull/26971

   ## Which issue does this PR close?
   
   Related to #24098. This PR addresses the output schema metadata mismatch.
   
   ## Rationale for this change
   
   When UNION inputs have different schema-level metadata, output batches can 
retain the metadata of their original inputs even though the UNION declares a 
merged schema. Consumers inspecting the returned batches therefore see 
incomplete or conflicting metadata.
   
   For example, the existing regression test produces a batch with `shared: 
input0`, while the declared output schema contains `shared: input2` and 
metadata keys from all three inputs.
   
   ## What changes are included in this PR?
   
   - Use `ProjectionExec::try_new_with_schema_metadata` in `coerce_schema` to 
apply the merged schema metadata to the projection output.
   - Strengthen `test_union_schema_metadata_and_nullability` to compare 
complete output batch schemas instead of only their fields.
   
   ## What is the testing strategy for this PR?
   
   The strengthened test fails before the fix and passes afterward across all 
five nullability combinations. It also verifies that output values are 
preserved.
   
   Passed locally:
   
   - `cargo fmt --all`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - The workspace extended test command from `AGENTS.md`, including all 545 
SQLLogicTest files.
   
   ## Are there any user-facing changes?
   
   UNION output batches now carry the merged schema-level metadata declared by 
the plan. Values and row counts are unchanged. There are no public API changes.
   


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