Repository navigation
Conversation
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25056 +/- ##
==========================================
- Coverage 82.80% 82.75% -0.06%
==========================================
Files 1149 1149
Lines 452234 452981 +747
Branches 452234 452981 +747
==========================================
+ Hits 374484 374874 +390
- Misses 54952 55299 +347
- Partials 22798 22808 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
kosiew
left a comment
There was a problem hiding this comment.
Thanks for working on this. The changes preserve cast options and explicit target-field semantics across protobuf round trips while maintaining compatibility with legacy messages. I found no blocking issues.
I have one optional suggestion for additional behavioral round-trip coverage. This is not a merge blocker.
I reviewed the tests but did not execute them locally.
| } | ||
|
|
||
| #[test] | ||
| fn cast_options_survive_proto_round_trip() { |
There was a problem hiding this comment.
Could we add a wire round-trip test in datafusion/proto/tests/cases/plans/ using a ProjectionExec that casts an invalid string like "9.1" from Utf8 to Int32? It would be useful to serialize and deserialize the plan with physical_plan_to_bytes and physical_plan_from_bytes, then verify that both plans return NULL with safe=true and an error with safe=false. The existing test checks option equality but not execution behavior across the public serialization path. This can be a follow-up.
There was a problem hiding this comment.
thanks for the review I've added the round trip test
|
🚀 |
Which issue does this PR close?
Rationale for this change
Physical cast protobuf hooks did not serialize
CastExproptions 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?
CastExpr,TryCastExpr, and their protobuf messages.CASTandTRY_CASTwhile keeping legacy type-only payload behavior.CastExpr::cast_optionsAPI adjustment.The protobuf changes are additive and backward compatible.
What is the testing strategy for this PR?
Added unit coverage for:
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 warningscargo check -p datafusion-proto --all-features./ci/scripts/doc_prettier_check.sh --write --allow-dirtyAre 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 borrowingCastOptions<'_>value rather than&CastOptions<'static>; the upgrade guide documents migration for code rebuilding casts.