Skip to content

Avoid converting named_struct to CAST(ROW AS RowType) in CoralSqlNode2 -> RelNode conversion #357

@ljfgem

Description

@ljfgem

Related discussion

In the translation path:

source SQL -> SourceLangSqlNode -> CoralSqlNode1 -> CoralRelNode -> CoralSqlNode2 -> TargetLangSqlNode -> target SQL

At present, for named_struct function in CoralSqlNode1, Calcite converts it to CAST(ROW AS RowType) in CoralRelNode, so in CoralSqlNode2, it's CAST(ROW AS RowType), which is different from named_struct in CoralSqlNode1. Note that only named_struct is a valid Coral IR.

So we should make the following changes:

  1. Avoid converting named_struct to CAST(ROW AS RowType) in CoralSqlNode2 -> RelNode conversion, and remove CastToNamedStructTransformer
  2. Add a transformer in coral-trino to convert named_struct to CAST(ROW AS RowType).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions