Skip to content

Support nested expressions #258

@EpsilonPrime

Description

@EpsilonPrime

Nested expressions were added to Substrait in substrait-io/substrait#351 (part of release 0.36.0). When given a plan with a nested expression, the validator complains that nested is not one of the valid expression types (which is expected because the validator currently only supports release 0.20.0).

Fatal error:
  Failed to parse relations field: Failed to parse input field: Failed to parse expressions field: Message type "substrait.Expression" has no field named "nested" at "Plan.relations[0].root.input.project.expressions[0]".
   Available Fields(except extensions): "['literal', 'selection', 'scalarFunction', 'windowFunction', 'ifThen', 'switchExpression', 'singularOrList', 'multiOrList', 'cast', 'subquery', 'enum']"...
{
  "relations": [
    {
      "root": {
        "input": {
          "project": {
            "input": {
              "read": {
                "baseSchema": {
                  "names": [
                    "s_suppkey",
                    "s_name",
                    "s_address",
                    "s_nationkey",
                    "s_phone",
                    "s_acctbal",
                    "s_comment"
                  ],
                  "struct": {
                    "types": [
                      {
                        "i64": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "string": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "string": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "i32": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "string": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "decimal": {
                          "scale": 2,
                          "precision": 15,
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      },
                      {
                        "string": {
                          "nullability": "NULLABILITY_REQUIRED"
                        }
                      }
                    ],
                    "nullability": "NULLABILITY_REQUIRED"
                  }
                },
                "projection": {
                  "select": {
                    "structItems": [
                      {
                        "field": 1
                      },
                      {
                        "field": 5
                      }
                    ]
                  },
                  "maintainSingularStruct": true
                },
                "namedTable": {
                  "names": [
                    "supplier"
                  ]
                }
              }
            },
            "expressions": [
              {
                "nested": {
                  "nullable": true,
                  "struct": {
                    "fields": [
                      {
                        "selection": {
                          "directReference": {
                            "structField": {}
                          },
                          "rootReference": {}
                        }
                      },
                      {
                        "selection": {
                          "directReference": {
                            "structField": {
                              "field": 1
                            }
                          },
                          "rootReference": {}
                        }
                      }
                    ]
                  }
                }
              }
            ]
          }
        },
        "names": [
          "supplier",
          "name",
          "acctbal"
        ]
      }
    }
  ],
  "version": {
    "minorNumber": 48,
    "producer": "hand-generated"
  }
}

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