zoudan commented on code in PR #3053:
URL: https://github.com/apache/calcite/pull/3053#discussion_r1097009533
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -4474,6 +4474,21 @@ protected void validateWhereOrOn(
SqlNode condition,
String clause) {
validateNoAggs(aggOrOverOrGroupFinder, condition, clause);
+ // SqlSelect need to expand alias
+ condition.accept(new SqlShuttle() {
+ @Override public @Nullable SqlNode visit(SqlCall call) {
+ call.getOperandList()
+ .stream()
+ .filter(node -> node != null)
Review Comment:
`node -> node != null` -> `Objects::nonNull` seems better, WDYT?
##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -5709,6 +5709,19 @@ public boolean isBangEqualAllowed() {
.withConformance(lenient).ok();
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-5486">[CALCITE-5486]
+ * SubQuery not support HAVING alias in where condition</a>. */
+ @Test void testHavingAliasInCondition() {
Review Comment:
Should we also add a test in `SqlToRelConverterTest` to ensure we get the
right plan?
--
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]