xiedeyantu commented on code in PR #4748:
URL: https://github.com/apache/calcite/pull/4748#discussion_r2694600253
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -6426,6 +6426,21 @@ private void checkLiteral2(String expression, String
expected) {
sql(query).withConfig(c -> c.withExpand(false)).ok(expected);
}
+ @Test void testSubQueryWithSelfJoin() {
Review Comment:
Here you need to add a Javadoc with a Jira link. Please refer to other test
cases for more information.
##########
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java:
##########
@@ -2242,12 +2243,37 @@ public SqlSelect asSelect() {
if (node instanceof SqlSelect) {
return (SqlSelect) node;
}
- if (!dialect.hasImplicitTableAlias()) {
+ if (!dialect.hasImplicitTableAlias() || hasConflictTableAlias(node,
neededAlias)) {
return wrapSelect(asFrom());
}
return wrapSelect(node);
}
+ private boolean hasConflictTableAlias(SqlNode node, @Nullable String
neededAlias) {
Review Comment:
```suggestion
private boolean hasConflictTableAlias(SqlNode node) {
```
The neededAlias should not need to be passed.
--
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]