tristaZero commented on a change in pull request #9929:
URL: https://github.com/apache/shardingsphere/pull/9929#discussion_r606788634



##########
File path: 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/resources/sharding/select.xml
##########
@@ -453,4 +453,19 @@
         <input sql="SELECT * FROM t_account, t_account_detail WHERE 
t_account.account_id = 1 AND t_account.account_id = 
t_account_detail.account_id" />
         <output sql="SELECT * FROM t_account_1, t_account_detail_1 WHERE 
t_account_1.account_id = 1 AND t_account_1.account_id = 
t_account_detail_1.account_id" />
     </rewrite-assertion>
+
+    <rewrite-assertion 
id="select_with_join_table_on_condition_with_qualified_columns">

Review comment:
       Hi, this PR looks generally correct,  thanks for your work.
   Also, the focus of the relevant issue is about `whereSegment` and SQL route, 
right? So could you add an integrated test to make sure this `join and in` SQL 
has a correct execution result completely?
   
   ### How?
   Please refer to the case in line 102 of 
`shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dql/dql-integration-test-cases.xml`.
 This case is very similar to your PR.
   
   And last but not least, have a great holiday, :)

##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/util/WhereSegmentExtractUtils.java
##########
@@ -41,7 +41,28 @@
  */
 @NoArgsConstructor(access = AccessLevel.PRIVATE)
 public final class WhereSegmentExtractUtils {
-    
+
+    /**
+     * Get join where segment from SelectStatement.
+     *
+     * @param selectStatement SelectStatement
+     * @return join where segment collection.
+     */
+    public static Collection<WhereSegment> getJoinWhereSegments(final 
SelectStatement selectStatement) {
+        if (null == selectStatement.getFrom()) {
+            return Collections.emptyList();
+        }
+        TableSegment tableSegment = selectStatement.getFrom();
+        Collection<WhereSegment> result = new LinkedList<>();
+        if (tableSegment instanceof JoinTableSegment && null != 
((JoinTableSegment) tableSegment).getCondition()) {
+            ExpressionSegment expressionSegment = ((JoinTableSegment) 
tableSegment).getCondition();
+            WhereSegment whereSegment = new 
WhereSegment(expressionSegment.getStartIndex(), 
expressionSegment.getStopIndex(), expressionSegment);
+            result.add(whereSegment);
+        }
+

Review comment:
       Please remove this blank line.




-- 
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]


Reply via email to