You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jingsong Lee (Jira)" <ji...@apache.org> on 2020/05/25 05:39:00 UTC

[jira] [Assigned] (FLINK-17651) DecomposeGroupingSetsRule generates wrong plan when there exist distinct agg and simple agg with same filter

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

Jingsong Lee reassigned FLINK-17651:
------------------------------------

    Assignee: Shuo Cheng

> DecomposeGroupingSetsRule generates wrong plan when there exist distinct agg and simple agg with same filter
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-17651
>                 URL: https://issues.apache.org/jira/browse/FLINK-17651
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.10.1
>            Reporter: Shuo Cheng
>            Assignee: Shuo Cheng
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>
> Consider adding the following test case to org.apache.flink.table.planner.runtime.batch.sql.agg.AggregateITCaseBase. As you can see, the actual result is wrong.
>  
> {code:java}
> @Test
> def testSimpleAndDistinctAggWithCommonFilter(): Unit = {
>   val sql =
>     """
>       |SELECT
>       |   h,
>       |   COUNT(1) FILTER(WHERE d > 1),
>       |   COUNT(1) FILTER(WHERE d < 2),
>       |   COUNT(DISTINCT e) FILTER(WHERE d > 1)
>       |FROM Table5
>       |GROUP BY h
>       |""".stripMargin
>   checkResult(
>     sql,
>     Seq(
>       row(1,4,1,4),
>       row(2,7,0,7),
>       row(3,3,0,3)
>     )
>   )
> }
> Results
>  == Correct Result ==   == Actual Result ==
>  1,4,1,4                    1,0,1,4
>  2,7,0,7                    2,0,0,7
>  3,3,0,3                    3,0,0,3
> {code}
> The problem lies in `DecomposeGroupingSetsRule`, which omits filter arg of aggregate call when doing some processing.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)