Skip to content

Substrait round trip fails for struct field access on lambda parameters #25017

Description

@LiaCastaneda

Describe the bug

A struct field access on a lambda parameter works in SQL, but fails once the plan is converted to Substrait and back.

To Reproduce

CREATE TABLE t AS SELECT [named_struct('a', 1, 'b', 'x')] AS s;
SELECT array_transform(s, x -> get_field(x, 'b')) FROM t;

The query runs fine on its own. Converting its plan to Substrait (to_substrait_plan) and consuming it back (from_substrait_plan) fails:

Error during planning: Field b not found in struct

Expected behavior

The consumed plan loads and returns the same result as the original query.

Additional context

Substrait types carry no struct field names, so the consumer gives the lambda parameter declared in the plan the fields c0, c1, while the list s keeps its real names from the table schema.

Dotted access on lambda parameters in SQL (e -> e.field) was also reported here originally; it is a separate bug, now tracked in #27088.

Activity

  1. LiaCastaneda commented on Sep 9, 2026

    @LiaCastaneda
    ContributorAuthor

    ok not sure this is super urgent actually, we can use get_field and it will work

    SELECT array_transform(
      make_array(named_struct('rule_number', 1, 'rule_action', 'allow')),
      e -> get_field(e, 'rule_action')
    );
    

    The roundtrip wont work though (SQL -> Logical -> substrait -> Logical)

  2. LiaCastaneda commented on Nov 1, 2026

    @LiaCastaneda
    ContributorAuthor

    take

  3. changed the title [-]Nested struct field access on lambda parameters is unsupported (SQL and Substrait)[/-] [+]Substrait round trip fails for struct field access on lambda parameters[/+] on Nov 4, 2026
  4. added a commit that references this issue on Nov 4, 2026
    238ae32
  5. added a commit that references this issue on Nov 5, 2026
    4d7f444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions