tristaZero commented on a change in pull request #5206: Simplify the
SelectStatement
URL:
https://github.com/apache/incubator-shardingsphere/pull/5206#discussion_r410154830
##########
File path:
shardingsphere-sql-parser/shardingsphere-sql-parser-binder/src/main/java/org/apache/shardingsphere/sql/parser/binder/statement/dml/SelectStatementContext.java
##########
@@ -262,8 +267,97 @@ private boolean isTable(final OwnerSegment owner, final
Collection<SimpleTableSe
return true;
}
+ private boolean isTable(final SimpleTableSegment owner, final
Collection<SimpleTableSegment> tableSegments) {
+ for (SimpleTableSegment each : tableSegments) {
+ String tableName = owner.getTableName().getIdentifier().getValue();
+ if (tableName.equals(each.getAlias().orElse(null)) &&
!tableName.equals(each.getTableName().getIdentifier().getValue())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
@Override
public Optional<WhereSegment> getWhere() {
return getSqlStatement().getWhere();
}
+
+ /**
+ * get tables.
+ * @return tables.
+ */
+ public Collection<SimpleTableSegment> getSimpleTableSegments() {
+ Collection<SimpleTableSegment> result = getTables();
+ Collection<SimpleTableSegment> tables = new LinkedList<>();
Review comment:
Please exchange two of these names, since `result` is expected to return.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services