[ 
https://issues.apache.org/jira/browse/CALCITE-551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14266390#comment-14266390
 ] 

Julian Hyde commented on CALCITE-551:
-------------------------------------

That would be one way -- a good way -- to implement queries like this. Right 
now SQL-to-rel gets really tangled up when it sees a sub-query in an aggregate, 
so it doesn't get as far as decorrelation.

> Sub-query inside aggregate function
> -----------------------------------
>
>                 Key: CALCITE-551
>                 URL: https://issues.apache.org/jira/browse/CALCITE-551
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Julian Hyde
>            Assignee: Julian Hyde
>
> Calcite SQL-to-rel translator cannot handle a sub-query inside an aggregate 
> function. An example is SqlToRelConverterTest.testAggCaseInSubquery:
> {code}SELECT SUM(
>   CASE WHEN deptno IN (SELECT deptno FROM dept) THEN 1
>   ELSE 0 END)
> FROM emp{code}
> Similar issue CALCITE-516 involves IN with constant list inside an aggregate 
> function, which is treated similarly to a sub-query but is simpler.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to