Class PushCastIntoRow

java.lang.Object
io.trino.sql.planner.iterative.rule.ExpressionRewriteRuleSet
io.trino.sql.planner.iterative.rule.PushCastIntoRow

public class PushCastIntoRow extends ExpressionRewriteRuleSet
Transforms expressions of the form
  CAST(
      CAST(
          ROW(x, y)
          AS row(f1 type1, f2 type2))
      AS row(g1 type3, g2 type4))
 
to
  CAST(
      ROW(
          CAST(x AS type1),
          CAST(y AS type2))
      AS row(g1 type3, g2 type4))
 
Note: it preserves the top-level CAST if the row type has field names because the names are needed by the ROW to JSON cast TODO: ideally, the types involved in ROW to JSON cast should be captured at analysis time and remain fixed for the duration of the optimization process so as to have flexibility in terms of removing field names, which are irrelevant in the IR
  • Constructor Details

    • PushCastIntoRow

      public PushCastIntoRow()