You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/07/02 05:15:00 UTC
[jira] [Commented] (CALCITE-2391) Aggregate query with UNNEST or
LATERAL fails with ClassCastException
[ https://issues.apache.org/jira/browse/CALCITE-2391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16529388#comment-16529388 ]
Julian Hyde commented on CALCITE-2391:
--------------------------------------
I found that it the same problem occurs with aggregate queries with LATERAL, so I changed the summary accordingly.
I am testing a fix now.
> Aggregate query with UNNEST or LATERAL fails with ClassCastException
> --------------------------------------------------------------------
>
> Key: CALCITE-2391
> URL: https://issues.apache.org/jira/browse/CALCITE-2391
> Project: Calcite
> Issue Type: Bug
> Reporter: Volodymyr Vysotskyi
> Assignee: Julian Hyde
> Priority: Major
>
> Query with aggregation of UNNEST column fails with ClassCastException. This test:
> {code:java}
> @Test public void testAggUnnestColumn() {
> CalciteAssert.hr()
> .query("select count(d.\"name\") as c\n"
> + "from \"hr\".\"depts\" as d,\n"
> + " UNNEST(d.\"employees\") as e")
> .returnsUnordered(
> "C=3");
> }
> {code}
> added to {{JdbcTest}} class fails with {{ClassCastException}}
> {noformat}
> Caused by: java.lang.ClassCastException: org.apache.calcite.sql.validate.AggregatingSelectScope cannot be cast to org.apache.calcite.sql.validate.ListScope
> at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.lookupExp(SqlToRelConverter.java:4293)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertIdentifier(SqlToRelConverter.java:3614)
> at org.apache.calcite.sql2rel.SqlToRelConverter.access$2300(SqlToRelConverter.java:213)
> at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:4692)
> at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRelConverter.java:3990)
> at org.apache.calcite.sql.SqlIdentifier.accept(SqlIdentifier.java:344)
> at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4554)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2090)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:1957)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertFrom(SqlToRelConverter.java:2033)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:642)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:623)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3058)
> at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:559)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:264)
> at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
> at org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:783)
> at org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:642)
> at org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:612)
> at org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:232)
> at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:609)
> at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
> at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
> ... 28 more
> {noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)