Create issue https://issues.apache.org/jira/browse/CALCITE-580
On Fri, Jan 30, 2015 at 12:23 PM, Julian Hyde <[email protected]> wrote: > Looks like a bug. Can you file a jira case please. > > On Thu, Jan 29, 2015 at 8:10 PM, Chin Wei Low <[email protected]> > wrote: > > Hi, > > > > I have 2 Integer columns: a, c in table abc. > > > > While running the following sql, it throw the ClassCastException: > > select a, avg(c) as agg from abc group by a > > > > Exception in thread "main" java.lang.ClassCastException: java.lang.Long > > incompatible with java.lang.Integer > > at > > > org.apache.calcite.avatica.util.AbstractCursor$IntAccessor.getInt(AbstractCursor.java:460) > > at > > > org.apache.calcite.avatica.AvaticaResultSet.getInt(AvaticaResultSet.java:311) > > > > The generated code that I think causing the issue, it try to cast the > > result to long. > > public Object current() { > > final Object[] current = (Object[]) inputEnumerator.current(); > > return new Object[] { > > current[0], > > (long) org.apache.calcite.runtime.SqlFunctions.toInt(current[1]) / > > org.apache.calcite.runtime.SqlFunctions.toLong(current[2])}; > > } > > > > Am I missing anything here? > > > > Regards, > > Chin Wei >
