This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f7eeb332c0 Remove unnecessary null check in SQLNodeConverterEngine 
(#18201)
0f7eeb332c0 is described below

commit 0f7eeb332c08e9ee2f9240c5340599060bbc5fbb
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jun 6 20:53:19 2022 +0800

    Remove unnecessary null check in SQLNodeConverterEngine (#18201)
---
 .../federation/optimizer/converter/SQLNodeConverterEngine.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/converter/SQLNodeConverterEngine.java
 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/converter/SQLNodeConverterEngine.java
index 23dbe16e710..5de0ee74da3 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/converter/SQLNodeConverterEngine.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-federation/shardingsphere-infra-federation-optimizer/src/main/java/org/apache/shardingsphere/infra/federation/optimizer/converter/SQLNodeConverterEngine.java
@@ -62,11 +62,9 @@ public final class SQLNodeConverterEngine {
     public static SqlNode convertToSQLNode(final SQLStatement statement) {
         if (statement instanceof SelectStatement) {
             SqlNode sqlNode = new 
SelectStatementConverter().convertToSQLNode((SelectStatement) statement);
-            if (null != ((SelectStatement) statement).getUnions()) {
-                for (final UnionSegment unionSegment : ((SelectStatement) 
statement).getUnions()) {
-                    SqlNode unionSqlNode = 
convertToSQLNode(unionSegment.getSelectStatement());
-                    return new 
SqlBasicCall(convertUnionOperator(unionSegment.getUnionType()), new 
SqlNode[]{sqlNode, unionSqlNode}, SqlParserPos.ZERO);
-                }
+            for (UnionSegment each : ((SelectStatement) 
statement).getUnions()) {
+                SqlNode unionSqlNode = 
convertToSQLNode(each.getSelectStatement());
+                return new 
SqlBasicCall(convertUnionOperator(each.getUnionType()), new SqlNode[]{sqlNode, 
unionSqlNode}, SqlParserPos.ZERO);
             }
             return sqlNode;
         }

Reply via email to