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

Jark Wu reassigned FLINK-21655:
-------------------------------

    Assignee: lincoln lee

> Incorrect simplification for coalesce call on a groupingsets' result
> --------------------------------------------------------------------
>
>                 Key: FLINK-21655
>                 URL: https://issues.apache.org/jira/browse/FLINK-21655
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Planner
>    Affects Versions: 1.11.3, 1.12.2
>            Reporter: lincoln lee
>            Assignee: lincoln lee
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.13.0
>
>
> Currently the planner will do an incorrectly simplification for `coalesce` 
> call on a `groupingsets`'s result, see the following query example:
> {code:scala}
> val sqlQuery =
>  """
>  |SELECT
>  | a,
>  | b,
>  | coalesce(c, 'empty'),
>  | avg(d)
>  |FROM t1
>  |GROUP BY GROUPING SETS ((a, b), (a, b, c))
>  """.stripMargin
> {code}
> will generate a wrong plan which lost the `coalesce` call:
> {code}
> Calc(select=[a, b, c AS EXPR$2, EXPR$3])
> +- HashAggregate(isMerge=[true], groupBy=[a, b, c, $e], select=[a, b, c, $e, 
> Final_AVG(sum$0, count$1) AS EXPR$3])
>  +- Exchange(distribution=[hash[a, b, c, $e]])
>  +- LocalHashAggregate(groupBy=[a, b, c, $e], select=[a, b, c, $e, 
> Partial_AVG(d) AS (sum$0, count$1)])
>  +- Expand(projects=[\{a, b, c, d, 0 AS $e}, \{a, b, null AS c, d, 1 AS $e}])
>  +- TableSourceScan(table=[[default_catalog, default_database, t1]], 
> fields=[a, b, c, d])
> {code}



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

Reply via email to