Skip to content

fix: delegate the remaining codec methods in ComposedPhysicalExtensionCodec - #24973

Open
sainad2222 wants to merge 2 commits into
apache:mainfrom
sainad2222:fix/24829-composed-codec-full-delegation
Open

fix: delegate the remaining codec methods in ComposedPhysicalExtensionCodec#24973
sainad2222 wants to merge 2 commits into
apache:mainfrom
sainad2222:fix/24829-composed-codec-full-delegation

Conversation

@sainad2222

Copy link
Copy Markdown

Which issue does this PR close?

Rationale for this change

See #24829.

What changes are included in this PR?

Delegates the six missing methods to the child codecs.

One wrinkle: the four by-name hooks (udf, udaf, udwf,
higher_order_function) default to Ok(()) meaning "no payload, encode by
name", and decode only consults the registry when no payload is present. Naive
delegation wraps an empty blob and strands those functions, invisible at
position 0, where the tuple prost-encodes to zero bytes. Those four now use a
new encode_protobuf_by_name_aware, which emits a payload only when a codec
actually wrote bytes. try_encode_expr keeps the plain path; its default is an
error rather than Ok(()).

What is the testing strategy for this PR?

Four tests in physical_plan::tests::function_serde; two of them fail against
naive delegation.

Are there any user-facing changes?

try_encode_udf / try_encode_udaf were already delegated but carried the same
empty-payload bug, so they move to the new helper too. Happy to split that out.
No public API signatures changed.

@sainad2222 sainad2222 changed the title fix: delegate the remaining codec methods in ComposedPhysicalExtensio… fix: delegate the remaining codec methods in ComposedPhysicalExtension Sep 6, 2026
@github-actions github-actions Bot added the proto Related to proto crate label Sep 6, 2026
@sainad2222 sainad2222 changed the title fix: delegate the remaining codec methods in ComposedPhysicalExtension fix: delegate the remaining codec methods in ComposedPhysicalExtensionCodec Sep 6, 2026

@ryux1 ryux1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The by-name helper handles empty-success delegation carefully. The newly added expression path still inherits a separate composition bug.

Comment thread datafusion/proto/src/physical_plan/mod.rs

@ryux1 ryux1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new buffer reset isolates each codec attempt, and the regression covers a codec that writes before rejecting followed by one that succeeds. This addresses my concern. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proto Related to proto crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComposedPhysicalExtensionCodec implements only 6 of the 12 PhysicalExtensionCodec methods

2 participants