You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Kurt Young (JIRA)" <ji...@apache.org> on 2019/01/30 10:39:00 UTC
[jira] [Closed] (FLINK-8782) Rmove count agg if it is generated for
sum agg in over window
[ https://issues.apache.org/jira/browse/FLINK-8782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kurt Young closed FLINK-8782.
-----------------------------
Resolution: Unresolved
> Rmove count agg if it is generated for sum agg in over window
> -------------------------------------------------------------
>
> Key: FLINK-8782
> URL: https://issues.apache.org/jira/browse/FLINK-8782
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Reporter: Hequn Cheng
> Priority: Major
>
> Currently, sum agg in over window will generate another count agg which is redundant and affect performance.
> For the following sql:
> {code:java}
> val sqlQuery = "SELECT a, " +
> " SUM(b) OVER (" +
> " PARTITION BY a ORDER BY proctime ROWS BETWEEN 3 PRECEDING AND CURRENT ROW) " +
> "FROM MyTable"{code}
> the corresponding {{LogicalProject}} generated by over is:
> {code:java}
> CASE(>(COUNT($1) OVER (PARTITION BY $0 ORDER BY $5 ROWS BETWEEN 3 PRECEDING AND CURRENT ROW), 0), CAST($SUM0($1) OVER (PARTITION BY $0 ORDER BY $5 ROWS BETWEEN 3 PRECEDING AND CURRENT ROW)):BIGINT, null){code}
> count is used to return null if count is zero while this logic is redundant since sum agg function will return null in this case.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)