suibianwanwank commented on code in PR #4177:
URL: https://github.com/apache/calcite/pull/4177#discussion_r1942275831
##########
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java:
##########
@@ -456,7 +458,10 @@ public Result visit(Filter e) {
builder.context.toSql(null, e.getCondition())));
return builder.result();
} else {
- final Result x = visitInput(e, 0, Clause.WHERE);
+ Result x = visitInput(e, 0, Clause.WHERE);
+ if (e.getCondition().getKind() == NOT || e.getCondition().getKind() ==
EXISTS) {
Review Comment:
I suspect this doesn't cover all cases. e.g.
`e2."product_id" = selected."product_id" and e2."product_id" > 10`
How about resetting on parseCorrelTable?
```
+++
b/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java
@@ -1406,7 +1406,7 @@ public List<SqlNode> createAsFullOperands(RelDataType
rowType, SqlNode leftOpera
private void parseCorrelTable(RelNode relNode, Result x) {
for (CorrelationId id : relNode.getVariablesSet()) {
- correlTableMap.put(id, x.qualifiedContext());
+ correlTableMap.put(id, x.resetAlias().qualifiedContext());
}
}
```
--
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]