Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
There is a code generation error when argument to COUNT(DISTINCT ...) is a column in the GROUP BY clause. For example,
select count(distinct deptno) as cdd, count(*) as c from emp group by deptno
generates code that is invalid (! operator applied to a long value):
public Object current() { final Object[] current = (Object[]) inputEnumerator.current(); return new Object[] { current[0], current[1], !org.apache.calcite.runtime.SqlFunctions.toLong(current[1])}; }