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

   ## Which issue does this PR close?
   
   - Closes #25937.
   
   ## Rationale for this change
   
   The optimizer reduces queries like `SELECT * FROM t LIMIT 0` or `... WHERE 
false` to an `EmptyRelation` that keeps the schema of its input, but 
`EmptyRelationNode` only stored `produce_one_row`. After a protobuf round trip 
the plan came back without columns, and plans where another node refers to 
those columns, like `SELECT max(id), count(*) FROM t WHERE false`, failed to 
decode.
   
   ## What changes are included in this PR?
   
   - Add a `schema` field to `EmptyRelationNode`, encoded and decoded like 
`DropViewNode`.
   - Fall back to the previous empty schema for older payloads without it.
   - Regenerate the prost and pbjson models.
   - Add `roundtrip_empty_relation_schema` and update the expected JSON in 
`plan_to_json`.
   - Document the new generated field in the 56.0.0 upgrade guide.
   
   ## Are these changes tested?
   
   Yes:
   
   - `cargo test -p datafusion-proto --features json,avro --test 
proto_integration`
   - `cargo fmt --all -- --check`
   - `cargo clippy -p datafusion-proto -p datafusion-proto-models --all-targets 
--all-features -- -D warnings`
   - `./dev/rust_lint.sh`
   
   `json_to_plan` still decodes `{"emptyRelation":{}}`, which covers payloads 
from older versions.
   
   ## Are there any user-facing changes?
   
   Logical plans reduced to an `EmptyRelation` keep their schema across 
protobuf round trips. The wire format remains backward compatible; the 
generated `EmptyRelationNode` struct gains a `schema` field, documented in the 
upgrade guide.
   


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