diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/AbstractExecutionPrepareEngine.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/AbstractExecutionPrepareEngine.java index eea1fec1043b59..7519f521863b1b 100644 --- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/AbstractExecutionPrepareEngine.java +++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/AbstractExecutionPrepareEngine.java @@ -30,11 +30,11 @@ import java.sql.SQLException; import java.util.Collection; import java.util.Collections; -import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.TreeMap; /** * Abstract execution prepare engine. @@ -80,7 +80,7 @@ private List> group(final List sqlUnits) { protected abstract List> group(String dataSourceName, int connectionOffset, List> executionUnitGroups, ConnectionMode connectionMode) throws SQLException; private Map> aggregateExecutionUnitGroups(final Collection executionUnits) { - Map> result = new LinkedHashMap<>(executionUnits.size(), 1F); + Map> result = new TreeMap<>(); for (ExecutionUnit each : executionUnits) { result.computeIfAbsent(each.getDataSourceName(), unused -> new LinkedList<>()).add(each); }