Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
v1.5.2
-
None
Description
Here's a example to re-produce the error with kylin sample data:
select t1.leaf_categ_id, max_price, min_price, sum_price from (select leaf_categ_id, sum(price) as sum_price from kylin_sales group by leaf_categ_id) t1 join (select leaf_categ_id, max(price) as max_price from kylin_sales group by leaf_categ_id) t2 on t1.leaf_categ_id = t2.leaf_categ_id join (select leaf_categ_id, min(price) as min_price from kylin_sales group by leaf_categ_id) t3 on t1.leaf_categ_id = t3.leaf_categ_id order by t1.leaf_categ_id
And here's the error stack:
Caused by: java.lang.NullPointerException: null
at org.apache.kylin.query.relnode.OLAPProjectRel.implementOLAP(OLAPProjectRel.java:104)
at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:81)
at org.apache.kylin.query.relnode.OLAPSortRel.implementOLAP(OLAPSortRel.java:68)
at org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:81)
at org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:69)
at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:97)
at org.apache.calcite.adapter.enumerable.EnumerableSort.implement(EnumerableSort.java:70)
at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:102)
at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
at org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1171)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:297)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:196)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:721)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:588)
at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:558)
at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:214)
at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:573)
at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:571)
at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:135)
at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:186)
In OLAPJoinRel.implementOLAP, context only be allocated by root join node, and be deleted in all join node, including child join node. In another word, the count of context allocating and deleting is mismatch. That made the parent node of join got an empty context, and threw NPE.