buraksenn opened a new pull request, #25056: URL: https://github.com/apache/datafusion/pull/25056
## Which issue does this PR close? - Closes #24615. ## Rationale for this change Physical cast protobuf hooks did not serialize `CastExpr` options or explicit target-field metadata. A round trip could therefore change cast behavior, nullability, or metadata. The hooks also accessed fields individually, so future fields could be omitted silently. ## What changes are included in this PR? - Exhaustively destructure `CastExpr`, `TryCastExpr`, and their protobuf messages. - Preserve explicit target fields for `CAST` and `TRY_CAST` while keeping legacy type-only payload behavior. - Preserve all serializable Arrow cast/format options; reject custom formatter factories instead of silently dropping them. - Store decoded format strings in owned cast options. - Regenerate protobuf models and document the `CastExpr::cast_options` API adjustment. The protobuf changes are additive and backward compatible. ## What is the testing strategy for this PR? Added unit coverage for: - target-field and cast-option round trips - legacy payloads without the new fields - explicit default-shaped targets - malformed target-field types - unsupported formatter factories Validated with: - `cargo test -p datafusion-physical-expr --features proto expressions::cast::` - `cargo test -p datafusion-physical-expr --features proto expressions::try_cast::` - `cargo clippy -p datafusion-physical-expr -p datafusion-physical-expr-adapter --all-features --tests -- -D warnings` - `cargo check -p datafusion-proto --all-features` - `./ci/scripts/doc_prettier_check.sh --write --allow-dirty` ## Are there any user-facing changes? Cast expressions now retain their options and explicit output-field semantics across protobuf round trips. `CastExpr::cast_options()` returns a borrowing `CastOptions<'_>` value rather than `&CastOptions<'static>`; the upgrade guide documents migration for code rebuilding casts. -- 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]
