feat: migrate EmptyExec and PlaceholderRowExec to ExecutionPlan proto hooks - #23784
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the EmptyExec and PlaceholderRowExec physical leaf plans to the newer protobuf “plan self-serialization” hooks (ExecutionPlan::try_to_proto / X::try_from_proto) while preserving the existing wire format. This continues the ongoing effort to move protobuf encoding/decoding responsibility closer to each plan type and reduce the central downcast/match chains in datafusion-proto.
Changes:
- Implement
ExecutionPlan::try_to_protoforEmptyExecandPlaceholderRowExecindatafusion-physical-plan. - Add plan-specific
try_from_protoconstructors forEmptyExecandPlaceholderRowExec. - Route protobuf decoding through these new hooks and remove the old central encoding downcast arms, keeping deprecated helper methods as compatibility shims.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| datafusion/proto/src/physical_plan/mod.rs | Switch decode match arms to X::try_from_proto, remove central encoding downcast arms for these leaf plans, and keep deprecated helpers as shims delegating to the new hooks. |
| datafusion/physical-plan/src/placeholder_row.rs | Add try_to_proto and PlaceholderRowExec::try_from_proto implementations under feature = "proto". |
| datafusion/physical-plan/src/empty.rs | Add try_to_proto and EmptyExec::try_from_proto implementations under feature = "proto". |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
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 #23784 +/- ##
==========================================
- Coverage 80.71% 80.69% -0.02%
==========================================
Files 1090 1090
Lines 369828 369896 +68
Branches 369828 369896 +68
==========================================
- Hits 298493 298483 -10
- Misses 53548 53618 +70
- Partials 17787 17795 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| ) | ||
| })?; | ||
| let schema = Arc::new(arrow::datatypes::Schema::try_from(schema)?); | ||
| // Zero means the field was absent in the previous wire format. |
There was a problem hiding this comment.
Can we keep the comments / code verbatim? The old comment said:
// A zero (absent) partition count comes from a plan encoded before the
// field existed, which always meant a single partition.
… hooks (apache#23784) ## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes apache#123` indicates that this PR will close issue apache#123. --> - Closes apache#23501 . ## Rationale for this change Migrates the `EmptyExec` and `PlaceholderRowExec` leaf plans while preserving the existing protobuf wire format. <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> - Implement `ExecutionPlan::try_to_proto` for `EmptyExec` and `PlaceholderRowExec`. - Add plan-specific `try_from_proto` implementations. - Route protobuf encoding and decoding through the new hooks. - Keep the deprecated helper methods as compatibility shims. ## Are these changes tested? yes <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. --> Hi @andygrove , would you be willing to review this PR when you have time? Thanks!
Which issue does this PR close?
Rationale for this change
Migrates the
EmptyExecandPlaceholderRowExecleaf plans while preserving the existing protobuf wire format.What changes are included in this PR?
ExecutionPlan::try_to_protoforEmptyExecandPlaceholderRowExec.try_from_protoimplementations.Are these changes tested?
yes
Are there any user-facing changes?
Hi @andygrove , would you be willing to review this PR when you have time? Thanks!