[
https://issues.apache.org/jira/browse/CALCITE-7086?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
weihua zhang updated CALCITE-7086:
----------------------------------
Description:
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:java}
/*
* <pre>{@code
* SELECT job FROM "scott".emp WHERE deptno = 10
* INTERSECT
* SELECT job FROM "scott".emp WHERE deptno = 20
* }</pre>
*
* <p>Query after conversion:
* <pre>{@code
* SELECT job
* FROM (
* SELECT job, 0 AS i FROM "scott".emp WHERE deptno = 10
* UNION ALL
* SELECT job, 1 AS i FROM "scott".emp WHERE deptno = 20
* )
* GROUP BY job
* HAVING COUNT(*) FILTER (WHERE i = 0) > 0
* AND COUNT(*) FILTER (WHERE i = 1) > 0
* }</pre>
*/
{code}
was:
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
> 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
> Priority: Major
>
> 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:java}
> /*
> * <pre>{@code
> * SELECT job FROM "scott".emp WHERE deptno = 10
> * INTERSECT
> * SELECT job FROM "scott".emp WHERE deptno = 20
> * }</pre>
> *
> * <p>Query after conversion:
> * <pre>{@code
> * SELECT job
> * FROM (
> * SELECT job, 0 AS i FROM "scott".emp WHERE deptno = 10
> * UNION ALL
> * SELECT job, 1 AS i FROM "scott".emp WHERE deptno = 20
> * )
> * GROUP BY job
> * HAVING COUNT(*) FILTER (WHERE i = 0) > 0
> * AND COUNT(*) FILTER (WHERE i = 1) > 0
> * }</pre>
> */
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)