You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Laurent Goujon (JIRA)" <ji...@apache.org> on 2019/07/26 16:26:00 UTC

[jira] [Created] (CALCITE-3216) ClassCastException when running window function over union

Laurent Goujon created CALCITE-3216:
---------------------------------------

             Summary: ClassCastException when running window function over union
                 Key: CALCITE-3216
                 URL: https://issues.apache.org/jira/browse/CALCITE-3216
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Laurent Goujon


I discovered an issue in Calcite execution engine which can be captured by this simple query:
{code:sql}
select *, count(*) over (partition by "id") from (
select "id" from (VALUES(CAST(1 AS TINYINT))) "foo"("id")
union
select "id" from (VALUES(2)) "foo"("id"))
{code}

When running this query using JdbcTest for example, I got the following stacktrace:
{noformat}
Caused by: java.lang.ClassCastException: java.lang.Byte cannot be cast to java.lang.Integer
	at Baz$3.apply(ANONYMOUS.java:55)
	at org.apache.calcite.linq4j.DefaultEnumerable.foreach(DefaultEnumerable.java:77)
	at Baz.bind(Baz.java:43)
	at org.apache.calcite.jdbc.CalcitePrepare$CalciteSignature.enumerable(CalcitePrepare.java:355)
	at org.apache.calcite.jdbc.CalciteConnectionImpl.enumerable(CalciteConnectionImpl.java:316)
	at org.apache.calcite.jdbc.CalciteMetaImpl._createIterable(CalciteMetaImpl.java:506)
	at org.apache.calcite.jdbc.CalciteMetaImpl.createIterable(CalciteMetaImpl.java:497)
	at org.apache.calcite.avatica.AvaticaResultSet.execute(AvaticaResultSet.java:182)
	at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:64)
	at org.apache.calcite.jdbc.CalciteResultSet.execute(CalciteResultSet.java:1)
	at org.apache.calcite.avatica.AvaticaConnection$1.execute(AvaticaConnection.java:667)
	at org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:566)
	at org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:675)
	at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:156)
{noformat}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)