Skip to content

spark: ToSubstraitRel.toProtoSubstrait emits a bare-relation PlanRel that ProtoPlanConverter cannot read #1418

Open

Description

@nielspardon

ToSubstraitRel.toProtoSubstrait (spark/src/main/scala/io/substrait/spark/logical/ToSubstraitRel.scala) builds the proto.Plan by hand with RelProtoConverter instead of going through PlanProtoConverter. The resulting plan has a PlanRel holding a bare rel rather than a root, so it carries no output names, and it sets neither version nor execution_behavior.

substrait-java's own reader cannot load it: ProtoPlanConverter only models root PlanRels and rejects the bare relation (#1297 tracks the reader side).

Building the bytes from the POJO plan that ToSubstraitRel.convert already produces would fix all three, at the cost of emitting root instead of rel:

def toProtoSubstrait(p: LogicalPlan): Array[Byte] =
  new PlanProtoConverter().toProto(convert(p)).toByteArray

That changes the output shape of a public method, so it is a behavior change for callers that read the rel arm.

Measured on main at 1948a86 by reading the code; raised in review of #1415, which routes the method's PlanRel through NestingDetacher but leaves its shape as is.

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