Skip to content

Projects require unique expressions names error in substrait producer/consumer #10815

@richtia

Description

@richtia

Describe the bug

Datafusion substrait consumer is unable to produce/consumer a substrait plan that uses the same column names with different aliases

To Reproduce

import substrait.gen.proto.plan_pb2 as plan_pb2
from datafusion import SessionContext
from datafusion import substrait as ss

ctx = SessionContext()
sql_query = "SELECT PS_PARTKEY K1, PS_SUPPKEY AS K1 FROM 'partsupp'"

substrait_proto = plan_pb2.Plan()
substrait_plan = ss.substrait.serde.serialize_to_plan(sql_query, ctx)

Error:

DataFusion error: Plan("Projections require unique expression names but the expression \\"partsupp.ps_partkey AS k1\\" at position 0 and \\"partsupp.ps_suppkey AS k1\\" at position 1 have the same name. Consider aliasing (\\"AS\\") one of them.")')

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions