[
https://issues.apache.org/jira/browse/KYLIN-4860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295835#comment-17295835
]
ASF GitHub Bot commented on KYLIN-4860:
---------------------------------------
zhangayqian commented on pull request #1599:
URL: https://github.com/apache/kylin/pull/1599#issuecomment-791230483
There is a problem when `unionRel` calculates the `columnRowType`. The
current algorithm directly combines the left and right `sourceCols` into an
array with the length of 2 as the `sourceCols` of `unionRel`. However,
according to the design, it should be equal to the left or right `sourceCols`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> 使用多union all查询时抛出数组越界异常
> -----------------------
>
> Key: KYLIN-4860
> URL: https://issues.apache.org/jira/browse/KYLIN-4860
> Project: Kylin
> Issue Type: Bug
> Reporter: Yang
> Assignee: Yaqian Zhang
> Priority: Blocker
> Fix For: v3.1.2
>
>
> 使用如下多union all语句查询(goupy by的字段个数大于union all的子表个数):
> {code:java}
> select date,f1,f2,sum(c1) c1,sum(c2) c2
> from
> (select date,f1,f2,count(*) c1,0 c2
> from t1
> where date='2021-01-01'
> group by date,f1,f2
> union all
> select date,f1,f2,0 c1,count(*) c2
> from t2
> where date='2021-01-01'
> group by date,f1,f2) a
> group by date,f1,f2;
> {code}
> 报错如下:
> {code:java}
> Caused by: java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
> at java.util.ArrayList.rangeCheck(ArrayList.java:657)
> at java.util.ArrayList.get(ArrayList.java:433)
> at
> org.apache.kylin.query.relnode.ColumnRowType.getTupleExpressionByIndex(ColumnRowType.java:88)
> at
> org.apache.kylin.query.relnode.OLAPAggregateRel.buildGroups(OLAPAggregateRel.java:272)
> at
> org.apache.kylin.query.relnode.OLAPAggregateRel.buildColumnRowType(OLAPAggregateRel.java:216)
> at
> org.apache.kylin.query.relnode.OLAPAggregateRel.implementOLAP(OLAPAggregateRel.java:190)
> at
> org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:84)
> at
> org.apache.kylin.query.relnode.OLAPLimitRel.implementOLAP(OLAPLimitRel.java:77)
> at
> org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:84)
> at
> org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:77)
> at
> org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:103)
> at
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
> at
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1278)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
> at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:796)
> at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:655)
> at
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:618)
> at
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
> at
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
> at
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
> at
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
> ... 85 more
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)