[ 
https://issues.apache.org/jira/browse/IGNITE-3273?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergi Vladykin resolved IGNITE-3273.
------------------------------------
    Resolution: Fixed

merged to master

> SQL query parse error on map query side
> ---------------------------------------
>
>                 Key: IGNITE-3273
>                 URL: https://issues.apache.org/jira/browse/IGNITE-3273
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>            Reporter: Alexei Scherbakov
>             Fix For: 1.7
>
>         Attachments: Example2.java
>
>
> Distributed SQL query cannot be parsed on map side if it contains left join.
> The same local query works without any error.
> Replacing left join with inner join removes the error.
> See the attachment for the reproducer.
> {noformat}
> [10:40:58,850][ERROR][main][GridMapQueryExecutor] Failed to execute local 
> query: GridQueryRequest [reqId=1, pageSize=1024, space=P, 
> qrys=[GridCacheSqlQuery [qry=SELECT
> PERSON._KEY __C0,
> PERSON._VAL __C1,
> PERSON.NAME __C2,
> PERSON.ID __C3,
> PERSON.DEPID __C4,
> DEP._KEY __C5,
> DEP._VAL __C6,
> DEP.NAME __C7,
> DEP.ID __C8,
> DEP.ORGID __C9,
> ORG._KEY __C10,
> ORG._VAL __C11,
> ORG.NAME __C12,
> ORG.ID __C13
> FROM P.PERSON 
>  INNER JOIN D.DEPARTMENT DEP 
>  LEFT OUTER JOIN O.ORG ORG 
>  ON ORG.ID = DEP.ORGID
> WHERE DEP.ID = P.PERSON.DEPID, params=[], paramIdxs=[], paramsSize=0, 
> cols={__C0=GridSqlType [type=4, scale=0, precision=10, displaySize=11, 
> sql=INTEGER], __C1=GridSqlType [type=19, scale=0, precision=2147483647, 
> displaySize=2147483647, sql=OTHER], __C2=GridSqlType [type=13, scale=0, 
> precision=2147483647, displaySize=2147483647, sql=VARCHAR], __C3=GridSqlType 
> [type=4, scale=0, precision=10, displaySize=11, sql=INTEGER], 
> __C4=GridSqlType [type=4, scale=0, precision=10, displaySize=11, 
> sql=INTEGER], __C5=GridSqlType [type=4, scale=0, precision=10, 
> displaySize=11, sql=INTEGER], __C6=GridSqlType [type=19, scale=0, 
> precision=2147483647, displaySize=2147483647, sql=OTHER], __C7=GridSqlType 
> [type=13, scale=0, precision=2147483647, displaySize=2147483647, 
> sql=VARCHAR], __C8=GridSqlType [type=4, scale=0, precision=10, 
> displaySize=11, sql=INTEGER], __C9=GridSqlType [type=4, scale=0, 
> precision=10, displaySize=11, sql=INTEGER], __C10=GridSqlType [type=4, 
> scale=0, precision=10, displaySize=11, sql=INTEGER], __C11=GridSqlType 
> [type=19, scale=0, precision=2147483647, displaySize=2147483647, sql=OTHER], 
> __C12=GridSqlType [type=13, scale=0, precision=2147483647, 
> displaySize=2147483647, sql=VARCHAR], __C13=GridSqlType [type=4, scale=0, 
> precision=10, displaySize=11, sql=INTEGER]}, alias=null]], 
> topVer=AffinityTopologyVersion [topVer=1, minorTopVer=0], extraSpaces=[D, O], 
> parts=null]
> class org.apache.ignite.IgniteCheckedException: Failed to parse SQL query: 
> SELECT
> PERSON._KEY __C0,
> PERSON._VAL __C1,
> PERSON.NAME __C2,
> PERSON.ID __C3,
> PERSON.DEPID __C4,
> DEP._KEY __C5,
> DEP._VAL __C6,
> DEP.NAME __C7,
> DEP.ID __C8,
> DEP.ORGID __C9,
> ORG._KEY __C10,
> ORG._VAL __C11,
> ORG.NAME __C12,
> ORG.ID __C13
> FROM P.PERSON 
>  INNER JOIN D.DEPARTMENT DEP 
>  LEFT OUTER JOIN O.ORG ORG 
>  ON ORG.ID = DEP.ORGID
> WHERE DEP.ID = P.PERSON.DEPID
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:828)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQueryWithTimer(IgniteH2Indexing.java:870)
>       at 
> org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onQueryRequest(GridMapQueryExecutor.java:454)
>       at 
> org.apache.ignite.internal.processors.query.h2.twostep.GridMapQueryExecutor.onMessage(GridMapQueryExecutor.java:184)
>       at 
> org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.send(GridReduceQueryExecutor.java:1065)
>       at 
> org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExecutor.query(GridReduceQueryExecutor.java:572)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$2.iterator(IgniteH2Indexing.java:971)
>       at 
> org.apache.ignite.internal.processors.cache.QueryCursorImpl.iterator(QueryCursorImpl.java:61)
>       at 
> org.apache.ignite.internal.processors.cache.QueryCursorImpl.getAll(QueryCursorImpl.java:73)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.replicated.Example2.main(Example2.java:40)
> Caused by: org.h2.jdbc.JdbcSQLException: Column "DEP.ORGID" not found; SQL 
> statement:
> SELECT
> PERSON._KEY __C0,
> PERSON._VAL __C1,
> PERSON.NAME __C2,
> PERSON.ID __C3,
> PERSON.DEPID __C4,
> DEP._KEY __C5,
> DEP._VAL __C6,
> DEP.NAME __C7,
> DEP.ID __C8,
> DEP.ORGID __C9,
> ORG._KEY __C10,
> ORG._VAL __C11,
> ORG.NAME __C12,
> ORG.ID __C13
> FROM P.PERSON 
>  INNER JOIN D.DEPARTMENT DEP 
>  LEFT OUTER JOIN O.ORG ORG 
>  ON ORG.ID = DEP.ORGID
> WHERE DEP.ID = P.PERSON.DEPID [42122-175]
>       at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
>       at org.h2.message.DbException.get(DbException.java:172)
>       at org.h2.message.DbException.get(DbException.java:149)
>       at 
> org.h2.expression.ExpressionColumn.optimize(ExpressionColumn.java:144)
>       at org.h2.expression.Comparison.optimize(Comparison.java:179)
>       at org.h2.command.dml.Select.setEvaluatableRecursive(Select.java:958)
>       at org.h2.command.dml.Select.preparePlan(Select.java:937)
>       at org.h2.command.dml.Select.prepare(Select.java:834)
>       at org.h2.command.Parser.prepareCommand(Parser.java:240)
>       at org.h2.engine.Session.prepareLocal(Session.java:436)
>       at org.h2.engine.Session.prepareCommand(Session.java:379)
>       at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1138)
>       at 
> org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:70)
>       at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:267)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:359)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.executeSqlQuery(IgniteH2Indexing.java:825)
>       ... 9 more
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to