Avoid converting `named_struct` to `CAST(ROW AS RowType)` in `CoralSqlNode2 -> RelNode` conversion
Closed this issue · 0 comments
ljfgem commented
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:
- Avoid converting
named_struct
toCAST(ROW AS RowType)
inCoralSqlNode2 -> RelNode
conversion, and remove CastToNamedStructTransformer - Add a transformer in coral-trino to convert
named_struct
toCAST(ROW AS RowType)
.