Christian, Are you able to share your code for the adapter? This would be helpful in understanding the problem. In short however, if you're pushing down aggregations, you should just make sure that you convert the result your adapter returns to a Long. (e.g. Long.valueOf(count.longValue()))
-- Michael Mior [email protected] 2017-11-09 10:41 GMT-05:00 Christian Tzolov <[email protected]>: > (Calcite 1.15.0-SNASHOT and Avalitca 1.10.0) > > I'm > workin on an adapter for in-memory NoSql > data > system > . The implementations tries to push down all supported aggregation > operations, such as AVG, MAX and COUNT. It works for most of them but fails > for COUNT: > > > 0: jdbc:calcite:model= > ... > > SELECT COUNT(*) FROM "BookMaster"; > > java.lang.ClassCastException: java.lang.Integer cannot be cast to > java.lang.Long > at > org.apache.calcite.avatica.util.AbstractCursor$LongAccessor.getLong( > AbstractCursor.java:550) > at org.apache.calcite.avatica.AvaticaSite.get(AvaticaSite.java:306) > at > org.apache.calcite.avatica.AvaticaResultSet.getObject( > AvaticaResultSet.java:409) > at sqlline.Rows$Row.<init>(Rows.java:157) > > P > roblem IMO is that the > COUNT result form the > underlaying system > is of type > Integer while > C > alcite expects Long > (e.g. BIGINT) as > hardcoded in SqlCountAggFunction > .java. > > I can't alter the SqlCountAggFunction so I wonder what is the right place > in Calcite to implement/configure this type conversion? > > This issue looks very similar ( > https://issues.apache.org/jira/browse/CALCITE-665) but i am not sure i > completely understand the resolution? > > Thanks, > Christian >
