You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jan Van Besien (JIRA)" <ji...@apache.org> on 2015/09/25 09:25:04 UTC

[jira] [Created] (CALCITE-898) explicit cast required where not expected

Jan Van Besien created CALCITE-898:
--------------------------------------

             Summary: explicit cast required where not expected
                 Key: CALCITE-898
                 URL: https://issues.apache.org/jira/browse/CALCITE-898
             Project: Calcite
          Issue Type: Bug
            Reporter: Jan Van Besien
            Assignee: Julian Hyde


As discussed on the mailinglist, there seems to be a bug related to unexpected casting of Long to Integer.

Queries such as these result in a ClassCastException.

{code}
select EMPNO * 3 as EMPNO from EMPS where EMPNO = 100
{code}

{code}
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
	at org.apache.calcite.avatica.util.AbstractCursor$IntAccessor.getInt(AbstractCursor.java:485)
	at org.apache.calcite.avatica.AvaticaSite.get(AvaticaSite.java:338)
	at org.apache.calcite.avatica.AvaticaResultSet.getObject(AvaticaResultSet.java:381)
{code}

I was able to reproduce the problem with the CsvTest, see attached patch. Note that, in the patch, I changed the datatype of EMPNO from int to long and that I use resultSet.getObject in stead of resultSet.getString to output the result set. With getString it works because it doesn't try to cast the Long to an Integer first.



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