[ 
https://issues.apache.org/jira/browse/CALCITE-5486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17693592#comment-17693592
 ] 

Jiajun Xie commented on CALCITE-5486:
-------------------------------------

[~libenchao], you are right. 
My solution only for where condition.

If we want to achieve other situations, 
I need to redesign and make major modifications.

> SubQuery not support HAVING alias in where condition
> ----------------------------------------------------
>
>                 Key: CALCITE-5486
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5486
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jiajun Xie
>            Assignee: Jiajun Xie
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Spark can allow HAVING alias in condition. 
> We also should allow HAVING alias in condition, here is the simple case.
> {code:java}
> sql("select * from emp where sal >\n"
>     + " (select avg(sal) as s"
>     + "    from emp having ^s^ > 0"
>     + "  )")
>     .withConformance(SqlConformanceEnum.LENIENT)
>     .fails("Column 'S' not found in any table"); // should be ok, but now is 
> fails{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to