[ 
https://issues.apache.org/jira/browse/CALCITE-7086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated CALCITE-7086:
------------------------------------
    Labels: pull-request-available  (was: )

> Implement a rule that performs the inverse operation of 
> AggregateCaseToFilterRule
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7086
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7086
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: weihua zhang
>            Assignee: Silun Dong
>            Priority: Major
>              Labels: pull-request-available
>
> Many databases do not support the form of filtered aggregates. It would be 
> helpful if we could implement a rule to convert the plan into a form that 
> most databases can understand.
> in CALCITE-6893:
> {code:sql}
> select * from emp where deptno = 10
> intersect
> select * from emp where deptno = 20
> intersect
> select * from emp where deptno = 30
> {code}
> {noformat}
> LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], 
> SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>   LogicalFilter(condition=[AND(>($9, 0), >($10, 0), >($11, 0))])
>     LogicalAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8}], count_i0=[COUNT() 
> FILTER $9], count_i1=[COUNT() FILTER $10], count_i2=[COUNT() FILTER $11])    
> // <---here
>       LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], $f10=[=($9, 
> 0)], $f11=[=($9, 1)], $f12=[=($9, 2)])
>         LogicalUnion(all=[true])
>           LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], i=[0])
>             LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>               LogicalFilter(condition=[=($7, 10)])
>                 LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>           LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], i=[1])
>             LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>               LogicalFilter(condition=[=($7, 20)])
>                 LogicalTableScan(table=[[CATALOG, SALES, EMP]])
>           LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], i=[2])
>             LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], 
> HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8])
>               LogicalFilter(condition=[=($7, 30)])
>                 LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to