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

Vladimir Ozerov updated IGNITE-8639:
------------------------------------
    Fix Version/s: 2.8

> Query with a lot of nesting causes NPE in org.h2.util.StringUtils.indent
> ------------------------------------------------------------------------
>
>                 Key: IGNITE-8639
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8639
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 2.6
>            Reporter: Ilya Kasnacheev
>            Assignee: Taras Ledkov
>            Priority: Minor
>              Labels: test
>             Fix For: 2.8
>
>         Attachments: SqlNestedQuerySelfTest.java
>
>
> Worked in 1.7!
> But now:
> {code}
>         sql("WITH cacheJoin (txId, stage, tStamp)" +
>               " AS (SELECT t.txId, o.stage, o.tStamp FROM txs t INNER JOIN 
> ops o ON t.txId = o.txId)" +
>             " SELECT ou.stage, COUNT(*) as cou, SUM(CASE WHEN ou.stage = 
> in.stage THEN 1 ELSE 0 END) AS ttl" +
>               " FROM (SELECT txId, stage FROM cacheJoin cte GROUP BY txId, 
> stage) ou" +
>                 " INNER JOIN (SELECT mx.txId, mx.stage FROM (SELECT txId, 
> tStamp, stage FROM cacheJoin cte) mx" +
>                   " INNER JOIN (SELECT txId, MAX(tStamp) AS maxTStamp FROM 
> cacheJoin cte GROUP BY txId) mix" +
>                     " ON mx.txId = mix.txId AND mx.tStamp = mix.maxTStamp) in 
> ON ou.txId = in.txId" +
>             " GROUP BY ou.stage");
> {code}
> {code}
> class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed 
> to parse query. Внутренняя ошибка: "java.lang.NullPointerException"
> General error: "java.lang.NullPointerException" [50000-195]
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatementAndCaches(IgniteH2Indexing.java:2026)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.parseAndSplit(IgniteH2Indexing.java:1796)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1652)
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2035)
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor$4.applyx(GridQueryProcessor.java:2030)
>       at 
> org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2578)
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2044)
>       at 
> org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:1990)
>       at 
> org.apache.ignite.internal.processors.query.SqlNestedQuerySelfTest.sql(SqlNestedQuerySelfTest.java:73)
>       at 
> org.apache.ignite.internal.processors.query.SqlNestedQuerySelfTest.testNestingQuery(SqlNestedQuerySelfTest.java:54)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:498)
>       at junit.framework.TestCase.runTest(TestCase.java:176)
>       at 
> org.apache.ignite.testframework.junits.GridAbstractTest.runTestInternal(GridAbstractTest.java:2086)
>       at 
> org.apache.ignite.testframework.junits.GridAbstractTest.access$000(GridAbstractTest.java:140)
>       at 
> org.apache.ignite.testframework.junits.GridAbstractTest$5.run(GridAbstractTest.java:2001)
>       at java.lang.Thread.run(Thread.java:748)
> Caused by: org.h2.jdbc.JdbcSQLException: Внутренняя ошибка: 
> "java.lang.NullPointerException"
> General error: "java.lang.NullPointerException" [50000-195]
>       at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
>       at org.h2.message.DbException.get(DbException.java:168)
>       at org.h2.message.DbException.convert(DbException.java:295)
>       at org.h2.message.DbException.toSQLException(DbException.java:268)
>       at org.h2.message.TraceObject.logAndConvert(TraceObject.java:352)
>       at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:292)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepare0(IgniteH2Indexing.java:484)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:452)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatement(IgniteH2Indexing.java:419)
>       at 
> org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.prepareStatementAndCaches(IgniteH2Indexing.java:2008)
>       ... 19 more
> Caused by: java.lang.NullPointerException
>       at org.h2.util.StringUtils.indent(StringUtils.java:594)
>       at org.h2.util.StringUtils.indent(StringUtils.java:582)
>       at org.h2.table.TableView.getSQL(TableView.java:436)
>       at org.h2.command.dml.Select.getPlanSQL(Select.java:1083)
>       at org.h2.index.ViewIndex.getPlanSQL(ViewIndex.java:134)
>       at org.h2.table.TableFilter.getPlanSQL(TableFilter.java:861)
>       at org.h2.command.dml.Select.getPlanSQL(Select.java:1103)
>       at org.h2.index.ViewIndex.getQuery(ViewIndex.java:397)
>       at org.h2.index.ViewIndex.<init>(ViewIndex.java:104)
>       at org.h2.table.TableView.getBestPlanItem(TableView.java:248)
>       at org.h2.table.TableFilter.getBestPlanItem(TableFilter.java:221)
>       at org.h2.table.Plan.calculateCost(Plan.java:123)
>       at org.h2.command.dml.Optimizer.testPlan(Optimizer.java:185)
>       at org.h2.command.dml.Optimizer.calculateBestPlan(Optimizer.java:81)
>       at org.h2.command.dml.Optimizer.optimize(Optimizer.java:244)
>       at org.h2.command.dml.Select.preparePlan(Select.java:1002)
>       at org.h2.command.dml.Select.prepare(Select.java:865)
>       at org.h2.command.Parser.prepareCommand(Parser.java:262)
>       at org.h2.engine.Session.prepareLocal(Session.java:573)
>       at org.h2.engine.Session.prepareCommand(Session.java:514)
>       at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204)
>       at 
> org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:73)
>       at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:288)
>       ... 23 more
> {code}
> See attached reproducer!



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to