Skip to content

refactor: Port TryCastExpr proto serialization hooks#22550

Open
chakkk309 wants to merge 2 commits into
apache:mainfrom
chakkk309:fix-try-cast-proto-hooks
Open

refactor: Port TryCastExpr proto serialization hooks#22550
chakkk309 wants to merge 2 commits into
apache:mainfrom
chakkk309:fix-try-cast-proto-hooks

Conversation

@chakkk309
Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

This is part of #22418, which migrates built-in PhysicalExpr implementations away from the central protobuf serialization / deserialization chains.

TryCastExpr can now own its protobuf serialization through PhysicalExpr::try_to_proto and its deserialization through TryCastExpr::try_from_proto, matching the pattern used by previously migrated physical expressions.

What changes are included in this PR?

  • Adds PhysicalExpr::try_to_proto support for TryCastExpr.
  • Adds TryCastExpr::try_from_proto.
  • Wires TryCastExpr deserialization in from_proto.rs through the new hook.
  • Removes the old TryCastExpr serialization branch from the central to_proto.rs downcast chain.
  • Adds direct proto hook tests for successful encoding / decoding and invalid protobuf inputs.

Are these changes tested?

Yes.

I ran:

cargo fmt --all --check
git diff --check
cargo test -p datafusion-physical-expr --features proto try_cast
cargo test -p datafusion-proto --test proto_integration
cargo clippy -p datafusion-physical-expr --features proto --tests -- -D warnings
cargo clippy -p datafusion-proto --tests -- -D warnings

Are there any user-facing changes?

No. This is an internal protobuf serialization refactor for TryCastExpr; the wire format remains unchanged.

@github-actions github-actions Bot added physical-expr Changes to the physical-expr crates proto Related to proto crate labels May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port TryCastExpr to use try_to_proto / try_from_proto

1 participant