This is an automated email from the ASF dual-hosted git repository.
chengzhang 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 ac1895093c0 Refactor ConditionValueInOperatorGenerator logic (#30000)
ac1895093c0 is described below
commit ac1895093c09625e45c66228bf1fb5d4eb391780
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Mon Feb 5 14:02:50 2024 +0800
Refactor ConditionValueInOperatorGenerator logic (#30000)
---
.../condition/generator/impl/ConditionValueInOperatorGenerator.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueInOperatorGenerator.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueInOperatorGenerator.java
index 62dbc165aad..fc2a215d5f7 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueInOperatorGenerator.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/condition/generator/impl/ConditionValueInOperatorGenerator.java
@@ -28,6 +28,7 @@ import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.expr.InExpres
import org.apache.shardingsphere.timeservice.core.rule.TimestampServiceRule;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
@@ -40,8 +41,9 @@ public final class ConditionValueInOperatorGenerator
implements ConditionValueGe
@Override
public Optional<ShardingConditionValue> generate(final InExpression
predicate, final Column column, final List<Object> params, final
TimestampServiceRule timestampServiceRule) {
List<Comparable<?>> shardingConditionValues = new LinkedList<>();
- List<Integer> parameterMarkerIndexes = new
ArrayList<>(predicate.getExpressionList().size());
- for (ExpressionSegment each : predicate.getExpressionList()) {
+ Collection<ExpressionSegment> expressionSegments =
predicate.getExpressionList();
+ List<Integer> parameterMarkerIndexes = new
ArrayList<>(expressionSegments.size());
+ for (ExpressionSegment each : expressionSegments) {
ConditionValue conditionValue = new ConditionValue(each, params);
Optional<Comparable<?>> value = conditionValue.getValue();
if (conditionValue.isNull()) {