JiajunBernoulli commented on code in PR #3055:
URL: https://github.com/apache/calcite/pull/3055#discussion_r1094102728


##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -5673,6 +5673,21 @@ public boolean isBangEqualAllowed() {
         .withConformance(strict).ok();
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5507";>[CALCITE-5507]
+   * HAVING alias failed when aggregate function in condition</a>. */
+  @Test void testAggregateFunAndAliasInHaving() {
+    final SqlConformanceEnum lenient = SqlConformanceEnum.LENIENT;
+    final SqlConformanceEnum strict = SqlConformanceEnum.STRICT_2003;
+
+    sql("select count(empno) as e from emp having ^e^ > 10 and count(empno) > 
10 ")

Review Comment:
   `^` is necessary , because 
[SqlTests](https://github.com/apache/calcite/blob/ae228f64347cc7620d28eff04f5869583c6bf9d5/testkit/src/main/java/org/apache/calcite/sql/test/SqlTests.java#L238)
 will check the position. 
   
   If we delete `^`, calcite will throw AssertionError:
   ```
   java.lang.AssertionError: Actual error had a position, but expected error 
did not. Add error position carets to sql:
   select count(empno) as e from emp having ^e^ > 10 and count(empno) > 10 
   ```
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to