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

tanxinyu pushed a commit to branch Computing-resource-balancing_cp
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 76a8f3450ef16b68f167bb6e19ac143412027dd1
Author: YongzaoDan <[email protected]>
AuthorDate: Sat Jul 22 21:33:55 2023 +0800

    Fix code smell and query IT
---
 .../src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java | 2 +-
 .../java/org/apache/iotdb/commons/partition/DataPartitionEntry.java  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java
index 454879aea90..82db0fdf154 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/orderBy/IoTDBOrderByIT.java
@@ -1318,7 +1318,7 @@ public class IoTDBOrderByIT {
           {"15", "15", "3147483648", "3147483648"},
           {"INT32", "INT32", "INT64", "INT64"}
         };
-    String sql = "select last bigNum,num from root.** order by value";
+    String sql = "select last bigNum,num from root.** order by value, 
timeseries";
     testLastQueryOrderBy(sql, ans);
   }
 
diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionEntry.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionEntry.java
index 449f8e45163..de5652d15b1 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionEntry.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartitionEntry.java
@@ -23,6 +23,7 @@ import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId;
 import org.apache.iotdb.common.rpc.thrift.TSeriesPartitionSlot;
 import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 
+import java.security.SecureRandom;
 import java.util.Objects;
 import java.util.Random;
 
@@ -40,7 +41,7 @@ public class DataPartitionEntry implements 
Comparable<DataPartitionEntry> {
     this.seriesPartitionSlot = seriesPartitionSlot;
     this.timePartitionSlot = timePartitionSlot;
     this.dataRegionGroup = dataRegionGroup;
-    this.weight = new Random().nextInt();
+    this.weight = new SecureRandom().nextInt();
   }
 
   public TSeriesPartitionSlot getSeriesPartitionSlot() {
@@ -60,7 +61,7 @@ public class DataPartitionEntry implements 
Comparable<DataPartitionEntry> {
     // The timePartitionSlot will be in descending order
     // After invoke Collections.sort()
     if (!timePartitionSlot.equals(o.timePartitionSlot)) {
-      return -timePartitionSlot.compareTo(o.timePartitionSlot);
+      return o.timePartitionSlot.compareTo(timePartitionSlot);
     }
     return Integer.compare(weight, o.weight);
   }

Reply via email to