[ https://issues.apache.org/jira/browse/HIVE-28321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17866341#comment-17866341 ]
Stamatis Zampetakis commented on HIVE-28321: -------------------------------------------- This is kinda a revert of HIVE-8194. Unfortunately, there is no much background why in HIVE-8194 they opted to not support alias in the HAVING clause apart from the fact that it is not standard behavior. At the moment various DBMS support this feature and there are various primitives in Calcite as well (CALCITE-1306) so it makes sense to make CBO handle this case. > Support select alias in the having clause for CBO > ------------------------------------------------- > > Key: HIVE-28321 > URL: https://issues.apache.org/jira/browse/HIVE-28321 > Project: Hive > Issue Type: Sub-task > Reporter: Ramesh Kumar Thangarajan > Assignee: Ramesh Kumar Thangarajan > Priority: Major > Labels: pull-request-available > > fname=limit_pushdown_negative.q > {code:sql} > explain select value, sum(key) as sum from src group by value having sum > > 100 limit 20 > {code} > {noformat} > org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException: > Encountered Select alias 'sum' in having clause 'sum > 100' This non standard > behavior is not supported with cbo on. Turn off cbo for these queries. > {noformat} -- This message was sent by Atlassian Jira (v8.20.10#820010)