Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6102

SqlWriter in SqlInsert's unparse start a list but does not end it

    XMLWordPrintableJSON

Details

    Description

      SqlWriter in SqlInsert's unparse() start a list but does not end it.

      There is a SparkSql :

      with tmp as (select * from t1) insert into t2 select * from tmp 

      I know calcite doesn't support parse "CTE + DML" for now.

      But in some situation, I'll create a SqlNode like that.

      SqlInsert sqlinsert;
      SqlWith sqlWith;
      // ....
      sqlWith.setOperand(1, sqlInsert);
      sqlWith.toString(); 

      if we put a SqlInsert into a SqlWith's body manually, when we unparse the SqlWith , it will throw an Expception :

      java.lang.IllegalArgumentException: Frame does not match current frame
       
      at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
      at org.apache.calcite.sql.pretty.SqlPrettyWriter.endList(SqlPrettyWriter.java:884)
      at org.apache.calcite.sql.SqlWith$SqlWithOperator.unparse(SqlWith.java:109) 

       

      Attachments

        Issue Links

          Activity

            People

              jiefei30 Mingcan Wang
              jiefei30 Mingcan Wang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: