[
https://issues.apache.org/jira/browse/CALCITE-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14535228#comment-14535228
]
Julian Hyde commented on CALCITE-716:
-------------------------------------
I figured that what is good for the SELECT clause should be good for the HAVING
clause. There is no reason to use AggFunctionsFinder for HAVING but not SELECT.
Sure enough, [~seanhychu]'s original patch fixes {code}SELECT emp.deptno FROM
emp group by emp.deptno having max(emp.empno) > (select min(emp.empno) from
emp);{code} but the problem still exists for {code}SELECT emp.deptno,
max(emp.empno) > (select min(emp.empno) from emp) as b FROM emp group by
emp.deptno;{code}
Can we work on a fix for that too?
> HAVING clause with subquery hits AssertionError
> -----------------------------------------------
>
> Key: CALCITE-716
> URL: https://issues.apache.org/jira/browse/CALCITE-716
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.3.0-incubating
> Reporter: Aman Sinha
> Assignee: Julian Hyde
> Fix For: next
>
>
> This may be a regression caused by CALCITE-694. Following query hits an
> AssertionError:
> {code}
> SELECT emp.deptno FROM emp group by emp.deptno having max(emp.empno) >
> (select min(emp.empno) from emp);
> {code}
> Stack trace:
> {code}
> java.lang.AssertionError: null
> at
> org.apache.calcite.sql2rel.RelStructuredTypeFlattener.getNewForOldInput(RelStructuredTypeFlattener.java:291)
> at
> org.apache.calcite.sql2rel.RelStructuredTypeFlattener$RewriteRexShuttle.visitInputRef(RelStructuredTypeFlattener.java:725)
> at
> org.apache.calcite.sql2rel.RelStructuredTypeFlattener$RewriteRexShuttle.visitInputRef(RelStructuredTypeFlattener.java:722)
> at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112)
> at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:134)
> at org.apache.calcite.rex.RexShuttle.visitCall(RexShuttle.java:83)
> at
> org.apache.calcite.sql2rel.RelStructuredTypeFlattener$RewriteRexShuttle.visitCall(RelStructuredTypeFlattener.java:795)
> at
> org.apache.calcite.sql2rel.RelStructuredTypeFlattener$RewriteRexShuttle.visitCall(RelStructuredTypeFlattener.java:722)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)