[ https://issues.apache.org/jira/browse/HIVE-24976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Krisztian Kasa reassigned HIVE-24976: ------------------------------------- Assignee: Krisztian Kasa > CBO: count(distinct) in a window function fails CBO > --------------------------------------------------- > > Key: HIVE-24976 > URL: https://issues.apache.org/jira/browse/HIVE-24976 > Project: Hive > Issue Type: Bug > Components: CBO > Reporter: Gopal Vijayaraghavan > Assignee: Krisztian Kasa > Priority: Major > > {code} > create temporary table tmp_tbl( > `rule_id` string, > `severity` string, > `alert_id` string, > `alert_type` string); > explain cbo > select `k`.`rule_id`, > count(distinct `k`.`alert_id`) over(partition by `k`.`rule_id`) `subj_cnt` > from tmp_tbl k > ; > explain > select `k`.`rule_id`, > count(distinct `k`.`alert_id`) over(partition by `k`.`rule_id`) `subj_cnt` > from tmp_tbl k > ; > {code} > Fails CBO, because the count(distinct) is not being recognized as belonging > to a windowing operation. > So it throws the following exception > {code} > throw new CalciteSemanticException("Distinct without an > aggregation.", > UnsupportedFeature.Distinct_without_an_aggreggation); > {code} > https://github.com/apache/hive/blob/73c3770d858b063c69dea6c64a759f8fdacad460/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java#L4914 > This prevents a query like this from using a materialized view which already > exists in the system (the MV obviously does not contain this expression, but > represents a complex transform from a JSON structure into a columnar layout). -- This message was sent by Atlassian Jira (v8.3.4#803005)