[
https://issues.apache.org/jira/browse/CALCITE-1293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde resolved CALCITE-1293.
----------------------------------
Resolution: Fixed
Fix Version/s: 1.13.0
Fixed in http://git-wip-us.apache.org/repos/asf/calcite/commit/2ddff7a5.
AggregateExpandDistinctAggregatesRule was getting field offsets wrong when
there was no indicator.
> Bad code generated when argument to COUNT(DISTINCT) is a GROUP BY column
> ------------------------------------------------------------------------
>
> Key: CALCITE-1293
> URL: https://issues.apache.org/jira/browse/CALCITE-1293
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Fix For: 1.13.0
>
>
> There is a code generation error when argument to {{COUNT(DISTINCT ...)}} is
> a column in the {{GROUP BY}} clause. For example,
> {code}
> select count(distinct deptno) as cdd, count(*) as c
> from emp
> group by deptno
> {code}
> generates code that is invalid ({{!}} operator applied to a {{long}} value):
> {noformat}
> public Object current() {
> final Object[] current = (Object[]) inputEnumerator.current();
> return new Object[] {
> current[0],
> current[1],
> !org.apache.calcite.runtime.SqlFunctions.toLong(current[1])};
> }
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)