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

SqlParseException when using component identifier for setting in merge statements

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.19.0
    • 1.20.0
    • core
    • OS: win10 (17763)

      JDK: 1.7

    Description

      The update section of "merge SQL" reports an error when using an alias

      // if i replace red code with "b = '123456'", I don't get an error
      String sql = "merge into xxx as t1 using yyy as t2 on t1.a = t2.a when matched then update set t1.b = '123456'" ; 
      SqlParser.ConfigBuilder configBuilder = SqlParser.configBuilder();
      configBuilder.setCaseSensitive(false);
      SqlParser.Config config = configBuilder.build();
      SqlParser parser = SqlParser.create(sql, config);
      SqlNode node = parser.parseQuery();
      

      the error

      //代码占位符
      Exception in thread "main" org.apache.calcite.sql.parser.SqlParseException: Encountered "." at line 1, column 84.
      Was expecting:
      "=" ...
      
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.convertException(SqlParserImpl.java:355)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.normalizeException(SqlParserImpl.java:143)
      at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:156)
      at com.yatop.Calcite.main(Calcite.java:39)
      Caused by: org.apache.calcite.sql.parser.impl.ParseException: Encountered "." at line 1, column 84.
      Was expecting:
      "=" ...
      
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.generateParseException(SqlParserImpl.java:25299)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.jj_consume_token(SqlParserImpl.java:25116)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.WhenMatchedClause(SqlParserImpl.java:1414)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlMerge(SqlParserImpl.java:1383)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmt(SqlParserImpl.java:861)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.SqlStmtEof(SqlParserImpl.java:877)
      at org.apache.calcite.sql.parser.impl.SqlParserImpl.parseSqlStmtEof(SqlParserImpl.java:199)
      at org.apache.calcite.sql.parser.SqlParser.parseQuery(SqlParser.java:148)
      ... 1 more
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            danny0405 Danny Chen
            wzqiang1332 wuzq
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m

                Slack

                  Issue deployment