-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.5.0
-
Component/s: None
-
Labels:None
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.
select EMPNO * 3 as EMPNO from EMPS where EMPNO = 100
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)
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.