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

liyang resolved KYLIN-1762.
---------------------------
       Resolution: Fixed
    Fix Version/s: v1.5.3

Merged to master.

> Query threw NPE with 3 or more join conditions
> ----------------------------------------------
>
>                 Key: KYLIN-1762
>                 URL: https://issues.apache.org/jira/browse/KYLIN-1762
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: v1.5.2
>            Reporter: Yerui Sun
>            Assignee: Yerui Sun
>             Fix For: v1.5.3
>
>         Attachments: KYLIN-1762.patch
>
>
> Here's a example to re-produce the error with kylin sample data:
> {code}
> 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
> {code}
> And here's the error stack:
> {code}
> 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)
> {code}
> 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.



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

Reply via email to