You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (JIRA)" <ji...@apache.org> on 2016/08/09 12:33:29 UTC

[jira] [Updated] (IGNITE-1886) NPE in H2 when running query with subselects

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

Pavel Tupitsyn updated IGNITE-1886:
-----------------------------------
    Fix Version/s:     (was: 1.7)
                   1.8

> NPE in H2 when running query with subselects
> --------------------------------------------
>
>                 Key: IGNITE-1886
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1886
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>            Reporter: Valentin Kulichenko
>            Assignee: Sergi Vladykin
>            Priority: Critical
>             Fix For: 1.8
>
>         Attachments: QueryTest.java
>
>
> Test reproducing the issue is attached. NPE is thrown as a result (see below).
> Corresponding user@ thread: http://apache-ignite-users.70518.x6.nabble.com/Does-Ignite-support-nested-SQL-Queries-td1714.html
> {noformat}
> Exception in thread "main" javax.cache.CacheException: class org.apache.ignite.IgniteException: Failed to parse query: SELECT a.* FROM (SELECT CASE WHEN u.id < 100 THEN u.id ELSE ug.id END id FROM "UserCache".user u, userorder ug WHERE u.id = ug.usrid) a, (SELECT CASE WHEN og.goodid < 5 THEN 100 ELSE og.goodid END id FROM userorder ug, "OrderGoodCache".ordergood og WHERE ug.id = og.orderid) b WHERE a.id = b.id
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:636)
> 	at org.apache.ignite.examples.ExampleNodeStartup.main(ExampleNodeStartup.java:70)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
> Caused by: class org.apache.ignite.IgniteException: Failed to parse query: SELECT a.* FROM (SELECT CASE WHEN u.id < 100 THEN u.id ELSE ug.id END id FROM "UserCache".user u, userorder ug WHERE u.id = ug.usrid) a, (SELECT CASE WHEN og.goodid < 5 THEN 100 ELSE og.goodid END id FROM userorder ug, "OrderGoodCache".ordergood og WHERE ug.id = og.orderid) b WHERE a.id = b.id
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:641)
> 	at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.query(IgniteCacheProxy.java:627)
> 	... 6 more
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to parse query: SELECT a.* FROM (SELECT CASE WHEN u.id < 100 THEN u.id ELSE ug.id END id FROM "UserCache".user u, userorder ug WHERE u.id = ug.usrid) a, (SELECT CASE WHEN og.goodid < 5 THEN 100 ELSE og.goodid END id FROM userorder ug, "OrderGoodCache".ordergood og WHERE ug.id = og.orderid) b WHERE a.id = b.id
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1510)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.queryTwoStep(GridQueryProcessor.java:634)
> 	... 7 more
> Caused by: javax.cache.CacheException: Failed to parse query: SELECT a.* FROM (SELECT CASE WHEN u.id < 100 THEN u.id ELSE ug.id END id FROM "UserCache".user u, userorder ug WHERE u.id = ug.usrid) a, (SELECT CASE WHEN og.goodid < 5 THEN 100 ELSE og.goodid END id FROM userorder ug, "OrderGoodCache".ordergood og WHERE ug.id = og.orderid) b WHERE a.id = b.id
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:938)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:636)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:634)
> 	at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
> 	at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:1492)
> 	... 8 more
> Caused by: org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-175]
> 	at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
> 	at org.h2.message.DbException.get(DbException.java:161)
> 	at org.h2.message.DbException.convert(DbException.java:284)
> 	at org.h2.message.DbException.toSQLException(DbException.java:257)
> 	at org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
> 	at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:270)
> 	at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.queryTwoStep(IgniteH2Indexing.java:935)
> 	... 12 more
> Caused by: java.lang.NullPointerException
> 	at org.h2.expression.Function.getCost(Function.java:2391)
> 	at org.h2.expression.Comparison.getCost(Comparison.java:480)
> 	at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:133)
> 	at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:131)
> 	at org.h2.command.dml.Select.prepare(Select.java:813)
> 	at org.h2.command.Parser.prepare(Parser.java:220)
> 	at org.h2.engine.Session.prepare(Session.java:403)
> 	at org.h2.index.ViewIndex.getCost(ViewIndex.java:159)
> 	at org.h2.table.TableView.getBestPlanItem(TableView.java:210)
> 	at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:184)
> 	at org.h2.table.Plan.calculateCost(Plan.java:111)
> 	at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:177)
> 	at org.h2.command.dml.Optimizer.calculateBruteForceAll(Optimizer.java:106)
> 	at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:83)
> 	at org.h2.command.dml.Optimizer.optimize(Optimizer.java:230)
> 	at org.h2.command.dml.Select.preparePlan(Select.java:933)
> 	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)
> 	... 13 more
> {noformat}



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