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 ad25471  Add javadoc (#14995)
ad25471 is described below

commit ad2547199b0abab7c079abba934800be7f5a7b1e
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Jan 22 13:49:05 2022 +0800

    Add javadoc (#14995)
---
 .../validator/dml/ShardingDMLStatementValidator.java       | 14 +++++++-------
 .../pipeline/scenario/rulealtered/RuleAlteredJobTest.java  |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
index f4a65d8..a540b0b 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
@@ -111,13 +111,14 @@ public abstract class ShardingDMLStatementValidator<T 
extends SQLStatement> impl
      * 
      * @param sqlStatementContext SQL statement context
      * @param shardingRule shardingRule
+     * @param assignments assignments
      * @param parameters parameter collection
      * @return sharding conditions
      */
     @SuppressWarnings({"rawtypes", "unchecked"})
     protected Optional<ShardingConditions> createShardingConditions(final 
SQLStatementContext<?> sqlStatementContext, final ShardingRule shardingRule,
                                                                     final 
Collection<AssignmentSegment> assignments, final List<Object> parameters) {
-        List<ShardingConditionValue> values = new LinkedList<>();
+        Collection<ShardingConditionValue> values = new LinkedList<>();
         String tableName = 
sqlStatementContext.getTablesContext().getTableNames().iterator().next();
         for (AssignmentSegment each : assignments) {
             String shardingColumn = 
each.getColumns().get(0).getIdentifier().getValue();
@@ -126,13 +127,12 @@ public abstract class ShardingDMLStatementValidator<T 
extends SQLStatement> impl
                 assignmentValue.ifPresent(optional -> values.add(new 
ListShardingConditionValue(shardingColumn, tableName, 
Collections.singletonList(optional))));
             }
         }
-        ShardingConditions result = null;
-        if (!values.isEmpty()) {
-            ShardingCondition shardingCondition = new ShardingCondition();
-            shardingCondition.getValues().addAll(values);
-            result = new 
ShardingConditions(Collections.singletonList(shardingCondition), 
sqlStatementContext, shardingRule);
+        if (values.isEmpty()) {
+            return Optional.empty();
         }
-        return Optional.ofNullable(result);
+        ShardingCondition shardingCondition = new ShardingCondition();
+        shardingCondition.getValues().addAll(values);
+        return Optional.of(new 
ShardingConditions(Collections.singletonList(shardingCondition), 
sqlStatementContext, shardingRule));
     }
     
     private Optional<Object> getShardingColumnAssignmentValue(final 
AssignmentSegment assignmentSegment, final List<Object> parameters) {
diff --git 
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobTest.java
 
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobTest.java
index a320d48..ab877be 100644
--- 
a/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobTest.java
+++ 
b/shardingsphere-test/shardingsphere-pipeline-test/src/test/java/org/apache/shardingsphere/data/pipeline/scenario/rulealtered/RuleAlteredJobTest.java
@@ -35,7 +35,7 @@ import static org.junit.Assert.assertNotNull;
 public final class RuleAlteredJobTest {
     
     @BeforeClass
-    public static void beforeClass() throws Exception {
+    public static void beforeClass() {
         EmbedTestingServer.start();
         PipelineContextUtil.mockModeConfig();
     }

Reply via email to