Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-16053

Calcite. Some kind of CROSS JOIN based queries can`t be parsed.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.15
    • sql

    Description

      Queries like attached can`t be planned.
      /modules/calcite/src/test/sql/sqlite/aggregates/agg1.test_ignored

      statement ok
      CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER)
      
      statement ok
      CREATE TABLE tab1(col0 INTEGER, col1 INTEGER, col2 INTEGER)
      
      statement ok
      CREATE TABLE tab2(col0 INTEGER, col1 INTEGER, col2 INTEGER)
      
      statement ok
      INSERT INTO tab0 VALUES(97,1,99)
      
      query I rowsort
      SELECT - 92 AS col1 FROM ( tab1 AS cor0 CROSS JOIN tab2 AS cor1 )
      ----
      9 values hashing to 1af709a79a3e56281ffdce4d931d5965
      
      query I rowsort
      SELECT - 13 FROM ( tab2 cor0 CROSS JOIN tab2 AS cor1 )
      ----
      9 values hashing to e95f5f4bd0f480397cced5f5e8a23792
      
      query I rowsort
      SELECT ALL + - 37 AS col0 FROM tab0 AS cor0 CROSS JOIN tab1 AS cor1
      ----
      9 values hashing to ed4644af7729c2425ea6cc3d84c6504f
      
      Caused by: class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to parse query.
      	at org.apache.ignite.internal.processors.query.calcite.util.Commons.parse(Commons.java:207)
      	at org.apache.ignite.internal.processors.query.calcite.CalciteQueryProcessor.query(CalciteQueryProcessor.java:339)
      	at org.apache.ignite.internal.processors.query.calcite.logical.SqlScriptRunner.sql(SqlScriptRunner.java:149)
      	at org.apache.ignite.internal.processors.query.calcite.logical.SqlScriptRunner.access$600(SqlScriptRunner.java:58)
      	at org.apache.ignite.internal.processors.query.calcite.logical.SqlScriptRunner$Query.execute(SqlScriptRunner.java:570)
      	... 3 more
      Caused by: org.apache.calcite.sql.parser.SqlParseException: Non-query expression encountered in illegal context
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.convertException(IgniteSqlParserImpl.java:397)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.normalizeException(IgniteSqlParserImpl.java:161)
      	at org.apache.calcite.sql.parser.SqlParser.handleException(SqlParser.java:145)
      	at org.apache.calcite.sql.parser.SqlParser.parseStmtList(SqlParser.java:200)
      	at org.apache.ignite.internal.processors.query.calcite.util.Commons.parse(Commons.java:222)
      	at org.apache.ignite.internal.processors.query.calcite.util.Commons.parse(Commons.java:204)
      	... 7 more
      Caused by: org.apache.calcite.runtime.CalciteException: Non-query expression encountered in illegal context
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      	at org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
      	at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:599)
      	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:932)
      	at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.checkNonQueryExpression(IgniteSqlParserImpl.java:320)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.Expression3(IgniteSqlParserImpl.java:4471)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.Expression2b(IgniteSqlParserImpl.java:4163)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.Expression2(IgniteSqlParserImpl.java:4204)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.Expression(IgniteSqlParserImpl.java:4134)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.LeafQueryOrExpr(IgniteSqlParserImpl.java:4116)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.QueryOrExpr(IgniteSqlParserImpl.java:4038)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.OrderedQueryOrExpr(IgniteSqlParserImpl.java:513)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.ParenthesizedExpression(IgniteSqlParserImpl.java:632)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.TableRef2(IgniteSqlParserImpl.java:2700)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.TableRef(IgniteSqlParserImpl.java:2641)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.FromClause(IgniteSqlParserImpl.java:2542)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.SqlSelect(IgniteSqlParserImpl.java:1783)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.LeafQuery(IgniteSqlParserImpl.java:601)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.LeafQueryOrExpr(IgniteSqlParserImpl.java:4119)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.QueryOrExpr(IgniteSqlParserImpl.java:4038)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.OrderedQueryOrExpr(IgniteSqlParserImpl.java:513)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.SqlStmt(IgniteSqlParserImpl.java:956)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.SqlStmtList(IgniteSqlParserImpl.java:906)
      	at org.apache.ignite.internal.processors.query.calcite.sql.IgniteSqlParserImpl.parseSqlStmtList(IgniteSqlParserImpl.java:213)
      	at org.apache.calcite.sql.parser.SqlParser.parseStmtList(SqlParser.java:198)
      	... 9 more
      
      
      

      Attachments

        Issue Links

          Activity

            People

              alex_pl Aleksey Plekhanov
              zstan Evgeny Stanilovsky
              Votes:
              0 Vote for this issue
              Watchers:
              3 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