xuzifu666 commented on code in PR #5193:
URL: https://github.com/apache/calcite/pull/5193#discussion_r3821461502
##########
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java:
##########
@@ -2864,11 +2864,17 @@ private SqlNode registerFrom(
expr = call.operand(0);
final boolean needAliasNamespace = call.operandCount() > 2
|| expr.getKind() == SqlKind.VALUES || expr.getKind() ==
SqlKind.UNNEST
- || expr.getKind() == SqlKind.COLLECTION_TABLE;
+ || expr.getKind() == SqlKind.COLLECTION_TABLE
+ || expr.getKind() == SqlKind.JOIN;
+ // For an aliased join, the join's children must not be visible outside
+ // the alias. Prevent JoinScope.addChild from propagating children to
+ // the using scope by using parentScope.
+ final SqlValidatorScope exprUsingScope =
Review Comment:
Thanks, agreed this is subtle. The intent is to prevent the children of an
aliased join from leaking into the outer scope; the new validator tests cover
that emp/bonus are no longer visible once the join is aliased as x.
--
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]