Vsevolod Ostapenko created KYLIN-3687:
-----------------------------------------
Summary: Top_N measure requires related SUM() measure to be
defined as part of the cube to work, but Web UI allows creation of the cube
that has Top_N measure only, resulting in NPE at query time
Key: KYLIN-3687
URL: https://issues.apache.org/jira/browse/KYLIN-3687
Project: Kylin
Issue Type: Improvement
Components: Measure - TopN, Metadata, Web
Affects Versions: v2.5.0
Environment: HDP 2.5.6, Kylin 2.5
Reporter: Vsevolod Ostapenko
Web UI allows defining a cube with Top_N measure without defining a related
SUM() measure. E.g. a variation of the kylin_sales_cube can be successfully
defined via UI with just TOP_SELLER without actually defining GVM_SUM measure.
Such cube builds just fine, but at the query time an NPE is thrown similar to
the following:
{quote}Caused by: java.lang.NullPointerException
at
org.apache.kylin.query.relnode.OLAPAggregateRel.rewriteAggregateCall(OLAPAggregateRel.java:561)
at
org.apache.kylin.query.relnode.OLAPAggregateRel.implementRewrite(OLAPAggregateRel.java:419)
at
org.apache.kylin.query.relnode.OLAPRel$RewriteImplementor.visitChild(OLAPRel.java:174)
at
org.apache.kylin.query.relnode.OLAPSortRel.implementRewrite(OLAPSortRel.java:86)
at
org.apache.kylin.query.relnode.OLAPRel$RewriteImplementor.visitChild(OLAPRel.java:174)
at
org.apache.kylin.query.relnode.OLAPLimitRel.implementRewrite(OLAPLimitRel.java:109)
at
org.apache.kylin.query.relnode.OLAPRel$RewriteImplementor.visitChild(OLAPRel.java:174)
at
org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:100)
at
org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:108)
at
org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
at
org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1281)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:228)
{quote}
There need to be some checks in the UI and in the Top_N query processing code
to ensure that all the required measures are defined (as Top_N is actually
dependent on another measure to function properly) and inform the user that
Top_N definition is incomplete and cube definition is invalid.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)