JiajunBernoulli commented on code in PR #3055:
URL: https://github.com/apache/calcite/pull/3055#discussion_r1111181943
##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -385,6 +385,23 @@ public static void checkActualAndReferenceFiles() {
.withConformance(SqlConformanceEnum.LENIENT).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 testAggregateFunAndAliasInHaving1() {
+ sql("select count(empno) as e\n"
+ + "from emp\n"
+ + "having e > 10 and count(empno) > 10")
+ .withConformance(SqlConformanceEnum.LENIENT).ok();
+ }
+
+ @Test void testAggregateFunAndAliasInHaving2() {
+ sql("select count(empno) as e\n"
+ + "from emp\n"
+ + "having e > 10 or count(empno) < 5")
Review Comment:
I want to show it because one is reduced and another is not reduced.
- `testAggregateFunAndAliasInHaving1`
`LogicalFilter(condition=[>($0, 10)])` has no `and`.
- `testAggregateFunAndAliasInHaving2`
`LogicalFilter(condition=[SEARCH($0, Sarg[(-∞..5), (10..+∞)])])` has `or`.
--
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]