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

Jiajun Xie edited comment on CALCITE-5507 at 2/1/23 12:43 PM:
--------------------------------------------------------------

Hi, [~nobigo] , ^ mean the error position. 

 

In Calcite, [Alias in aggregate is not 
allowed.|https://github.com/apache/calcite/blob/d1fe017e528230aaa10affb9111f62b08c50b186/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L5718]
 But the old validated way is incorrect, I use a new validated way to avoid 
misjudgment.


was (Author: jiajunbernoulli):
Hi, [~nobigo] , ^ mean the error position. 

 

In Calcite, Alias in aggregate is not allowed[1]. But the old validated way is 
incorrect, I use a new validated way to avoid misjudgment.

[1]https://github.com/apache/calcite/blob/d1fe017e528230aaa10affb9111f62b08c50b186/core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java#L5718

> HAVING alias failed when aggregate function in condition
> --------------------------------------------------------
>
>                 Key: CALCITE-5507
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5507
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Jiajun Xie
>            Assignee: Jiajun Xie
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> We know that calcite can support HAVING alias by setting 
> SqlConformanceEnum.LENIENT
> {code:java}
> sql("select count(empno) as e from emp having e > 10")
>     .withConformance(lenient).ok(); {code}
> but when I add one aggregate function in HAVING clause, it will fail.
> {code:java}
> sql("select count(empno) as e from emp having ^e^ > 10 and count(empno) > 10 
> ")
>     .withConformance(lenient).fails("Column 'E' not found in any table"); 
> // I think it should be ok{code}



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

Reply via email to