refactor(proto): migrate single-child plans#23710
Conversation
CoalesceBatches serialization still depends on centralized plan downcasts, keeping protobuf ownership outside the execution plan. Move encoding and decoding behind its ExecutionPlan hooks while preserving the existing wire fields. Keep the legacy helpers as deprecated compatibility APIs. Refs apache#23500 Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
CoalescePartitions serialization still depends on the central Merge dispatch, keeping protobuf ownership outside the execution plan. Move encoding and decoding behind its ExecutionPlan hooks while preserving the historical Merge wire variant and optional fetch field. Keep the legacy helpers as deprecated compatibility APIs. Refs apache#23500 Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
CooperativeExec serialization still depends on centralized plan dispatch despite carrying only one child. Move encoding and decoding behind its ExecutionPlan hooks, retain the legacy helpers as deprecated compatibility APIs, and add a direct round-trip test that proves the hooks are reached. Refs apache#23500 Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
BufferExec serialization still depends on centralized plan dispatch, keeping its protobuf capacity representation outside the execution plan. Move encoding and decoding behind its ExecutionPlan hooks, retain the legacy helpers as deprecated compatibility APIs, and verify capacity preservation with a direct round-trip test. CLOSES apache#23500 Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
|
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 #23710 +/- ##
========================================
Coverage 80.69% 80.70%
========================================
Files 1088 1089 +1
Lines 367741 368362 +621
Branches 367741 368362 +621
========================================
+ Hits 296761 297280 +519
- Misses 53272 53364 +92
- Partials 17708 17718 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| #[deprecated( | ||
| since = "55.0.0", | ||
| note = "unused by DataFusion; `CoalesceBatchesExec` deserializes itself via `CoalesceBatchesExec::try_from_proto`" | ||
| )] |
There was a problem hiding this comment.
Can we have the deprecated methods delegate to the originals?
| ), | ||
| PhysicalPlanType::Merge(merge) => { | ||
| self.try_into_merge_physical_plan(merge, ctx, proto_converter) | ||
| #[expect(deprecated)] |
There was a problem hiding this comment.
Why expect deprecated here? What deprecated method are we calling?
There was a problem hiding this comment.
try_from_proto itself is not deprecated. CoalesceBatchesExec is the deprecated item, and referring to it in CoalesceBatchesExec::try_from_proto triggers the deprecation lint. The attribute is scoped to this match arm to allow decoding the legacy protobuf variant.
FYI:#19622
The migrated PhysicalPlanNodeExt helpers retained independent encode and decode implementations after per-plan protobuf hooks became canonical. This duplicated wire-format logic and allowed the deprecated compatibility paths to drift from normal dispatch. Make the CoalesceBatches, CoalescePartitions, Cooperative, and Buffer helpers delegate through the execution-plan encode and decode contexts. Add coverage that compares legacy helper output with the canonical hooks for both serialization and deserialization. Signed-off-by: Jiawei Zhao <Phoenix500526@163.com>
e0cbf55 to
1c33ac2
Compare
Which issue does this PR close?
Rationale for this change
Physical plan serialization currently relies on centralized type
dispatch in
datafusion-proto. This separates serialization from theplans that own the relevant state and requires every built-in plan to
be handled specially.
Moving serialization into each plan keeps that logic with its owner and
allows the central dispatch chain to be removed incrementally.
CoalesceBatchesExecis deprecated but remains a supported public type.Migrating its existing serialization keeps the dispatch model
consistent without extending its lifetime or changing its behavior.
What changes are included in this PR?
CoalesceBatchesExecCoalescePartitionsExecCooperativeExecBufferExectry_from_protoimplementation.APIs.
CooperativeExecandBufferExec.Are these changes tested?
Yes
Are there any user-facing changes?
There are no runtime behavior or protobuf wire-format changes.
The old
PhysicalPlanNodeExtconversion helpers remain available butare deprecated in favor of the per-plan serialization hooks.