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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 0d3b9c3f188 [branch-2.1](load) fix wrong replica number when loading 
to table with no partition (#40635) (#40881)
0d3b9c3f188 is described below

commit 0d3b9c3f188ed93b845c5c22da768fb7c1e861f5
Author: zclllhhjj <zhaochan...@selectdb.com>
AuthorDate: Sun Sep 15 19:58:53 2024 +0800

    [branch-2.1](load) fix wrong replica number when loading to table with no 
partition (#40635) (#40881)
    
    pick https://github.com/apache/doris/pull/40635
---
 .../src/main/java/org/apache/doris/planner/OlapTableSink.java       | 6 +-----
 .../src/test/java/org/apache/doris/planner/OlapTableSinkTest.java   | 6 ------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
index 335e8af9dae..cfaa4d7d507 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/OlapTableSink.java
@@ -204,11 +204,7 @@ public class OlapTableSink extends DataSink {
 
         tSink.setTableId(dstTable.getId());
         tSink.setTupleId(tupleDescriptor.getId().asInt());
-        int numReplicas = 1;
-        for (Partition partition : dstTable.getPartitions()) {
-            numReplicas = 
dstTable.getPartitionInfo().getReplicaAllocation(partition.getId()).getTotalReplicaNum();
-            break;
-        }
+        int numReplicas = 
dstTable.getTableProperty().getReplicaAllocation().getTotalReplicaNum();
         tSink.setNumReplicas(numReplicas);
         tSink.setNeedGenRollup(dstTable.shouldLoadToNewRollup());
         tSink.setSchema(createSchema(tSink.getDbId(), dstTable, analyzer));
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/planner/OlapTableSinkTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/planner/OlapTableSinkTest.java
index 0ebea0e3b35..249b612c292 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/planner/OlapTableSinkTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/planner/OlapTableSinkTest.java
@@ -126,7 +126,6 @@ public class OlapTableSinkTest {
 
         Column partKey = new Column("k2", PrimitiveType.VARCHAR);
         Partition p1 = new Partition(1, "p1", index, distInfo);
-        Partition p2 = new Partition(2, "p2", index, distInfo);
 
         new Expectations() {
             {
@@ -140,8 +139,6 @@ public class OlapTableSinkTest {
                 result = PartitionType.RANGE;
                 partInfo.getPartitionColumns();
                 result = Lists.newArrayList(partKey);
-                dstTable.getPartitions();
-                result = Lists.newArrayList(p1, p2);
                 dstTable.getPartition(p1.getId());
                 result = p1;
             }
@@ -190,7 +187,6 @@ public class OlapTableSinkTest {
 
         Column partKey = new Column("k2", PrimitiveType.VARCHAR);
         Partition p1 = new Partition(1, "p1", index, distInfo);
-        Partition p2 = new Partition(2, "p2", index, distInfo);
 
         new Expectations() {
             {
@@ -204,8 +200,6 @@ public class OlapTableSinkTest {
                 result = PartitionType.LIST;
                 partInfo.getPartitionColumns();
                 result = Lists.newArrayList(partKey);
-                dstTable.getPartitions();
-                result = Lists.newArrayList(p1, p2);
                 dstTable.getPartition(p1.getId());
                 result = p1;
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to