Skip to content

Add ComposedLogicalExtensionCodec, the logical counterpart of ComposedPhysicalExtensionCodec #27930

Backlog

Description

@NoahKusaba

Is your feature request related to a problem or challenge?

datafusion-proto has ComposedPhysicalExtensionCodec to combine several
PhysicalExtensionCodecs, but nothing equivalent for LogicalExtensionCodec.
A logical plan is serialized with a single codec, so an application whose table
providers come from two independent crates (for example one codec per table
format) has to write its own composing codec.

Ballista hit this with its Iceberg integration: logical plans carry table
providers from the client to the scheduler, so Ballista's codec and the Iceberg
codec have to be combined. Ballista now ships its own
ComposedLogicalExtensionCodec (apache/datafusion-ballista#2752), which other
users would have to copy.

Describe the solution you'd like

Add datafusion_proto::logical_plan::ComposedLogicalExtensionCodec, with the
same wire layout as ComposedPhysicalExtensionCodec (the position of the
encoding codec plus its bytes), routing every LogicalExtensionCodec method.

The trait's default encoders for functions and file formats succeed without
writing anything, so with "first codec that succeeds wins" the first codec
would claim every function and file format. For these, the first codec that
writes something should win instead:

Being a new type, it can also report errors more helpfully than the physical
codec does today:

  • when exactly one codec recognised the node (returned something other than
    NotImplemented), return its error unchanged, keeping its kind and source
    chain;
  • otherwise list every codec's error, not only the last one;
  • report a payload that doesn't match the composed codecs as a configuration
    error saying both sides must compose the same codecs in the same order.

Describe alternatives you've considered

Additional context

#24973 (for #24829) routes the remaining methods of
ComposedPhysicalExtensionCodec and changes how functions sent by name are
encoded. This doesn't touch the physical codec, but follows the same function
handling, so the two can share one implementation once #24973 lands.

Willingness to contribute

Yes, I have a branch ready.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions