This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new e3aa314797d branch-4.0: [fix](cloud) normalize SHOW PARTITIONS display
for storage and replica #60871 (#63875)
e3aa314797d is described below
commit e3aa314797da411545a1ce925bb2a4d100ec6957
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jun 11 13:20:10 2026 +1000
branch-4.0: [fix](cloud) normalize SHOW PARTITIONS display for storage and
replica #60871 (#63875)
Cherry-picked from #60871
Co-authored-by: deardeng <[email protected]>
---
.../doris/common/proc/PartitionsProcDir.java | 17 ++++--
.../doris/tablefunction/MetadataGenerator.java | 10 ++--
.../doris/common/proc/PartitionsProcDirTest.java | 61 ++++++++++++++++++++++
3 files changed, 81 insertions(+), 7 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/PartitionsProcDir.java
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/PartitionsProcDir.java
index c2dee8d62fc..63a1bf65120 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/PartitionsProcDir.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/PartitionsProcDir.java
@@ -104,6 +104,7 @@ import java.util.stream.Collectors;
*/
public class PartitionsProcDir implements ProcDirInterface {
private static final Logger LOG =
LogManager.getLogger(PartitionsProcDir.class);
+ static final String CLOUD_STORAGE_MEDIUM_DISPLAY = "OBJECT_STORAGE";
public static final ImmutableList<String> TITLE_NAMES = new
ImmutableList.Builder<String>()
.add("PartitionId").add("PartitionName")
@@ -408,6 +409,14 @@ public class PartitionsProcDir implements ProcDirInterface
{
return partitionInfosInrernal.stream().map(pair ->
pair.second).collect(Collectors.toList());
}
+ public static String getStorageMediumDisplay(String storageMedium) {
+ return Config.isCloudMode() ? CLOUD_STORAGE_MEDIUM_DISPLAY :
storageMedium;
+ }
+
+ public static String getReplicaAllocationDisplay(String replicaAllocation)
{
+ return Config.isCloudMode() ? FeConstants.null_string :
replicaAllocation;
+ }
+
private List<Long> getPartitionVersions(OlapTable olapTable, List<Long>
partitionIds)
throws AnalysisException {
List<Long> partitionVersions;
@@ -579,8 +588,9 @@ public class PartitionsProcDir implements ProcDirInterface {
trow.addToColumnValue(new TCell().setIntVal(totalReplicaNum));
DataProperty dataProperty =
tblPartitionInfo.getDataProperty(partitionId);
- partitionInfo.add(dataProperty.getStorageMedium().name());
- trow.addToColumnValue(new
TCell().setStringVal(dataProperty.getStorageMedium().name()));
+ String storageMedium =
getStorageMediumDisplay(dataProperty.getStorageMedium().name());
+ partitionInfo.add(storageMedium);
+ trow.addToColumnValue(new TCell().setStringVal(storageMedium));
String cooldownTimeStr =
TimeUtils.longToTimeString(dataProperty.getCooldownTimeMs());
partitionInfo.add(cooldownTimeStr);
trow.addToColumnValue(new
TCell().setStringVal(cooldownTimeStr));
@@ -599,7 +609,8 @@ public class PartitionsProcDir implements ProcDirInterface {
partitionInfo.add(isInMemory);
trow.addToColumnValue(new TCell().setBoolVal(isInMemory));
// replica allocation
- String replica =
tblPartitionInfo.getReplicaAllocation(partitionId).toCreateStmt();
+ String replica = getReplicaAllocationDisplay(
+
tblPartitionInfo.getReplicaAllocation(partitionId).toCreateStmt());
partitionInfo.add(replica);
trow.addToColumnValue(new TCell().setStringVal(replica));
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
index d065c879bbc..ca15c3bb704 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
@@ -1651,15 +1651,17 @@ public class MetadataGenerator {
+ sizePair.second;
trow.addToColumnValue(new
TCell().setStringVal(readableDateSize)); // REMOTE_DATA_SIZE
trow.addToColumnValue(new
TCell().setStringVal(partition.getState().toString())); // STATE
- trow.addToColumnValue(new
TCell().setStringVal(partitionInfo.getReplicaAllocation(partitionId)
- .toCreateStmt())); // REPLICA_ALLOCATION
+ String replicaAllocation =
PartitionsProcDir.getReplicaAllocationDisplay(
+
partitionInfo.getReplicaAllocation(partitionId).toCreateStmt());
+ trow.addToColumnValue(new
TCell().setStringVal(replicaAllocation)); // REPLICA_ALLOCATION
trow.addToColumnValue(new
TCell().setIntVal(partitionInfo.getReplicaAllocation(partitionId)
.getTotalReplicaNum())); // REPLICA_NUM
trow.addToColumnValue(new
TCell().setStringVal(partitionInfo
.getStoragePolicy(partitionId))); // STORAGE_POLICY
DataProperty dataProperty =
partitionInfo.getDataProperty(partitionId);
- trow.addToColumnValue(new
TCell().setStringVal(dataProperty.getStorageMedium()
- .name())); // STORAGE_MEDIUM
+ String storageMedium = PartitionsProcDir
+
.getStorageMediumDisplay(dataProperty.getStorageMedium().name());
+ trow.addToColumnValue(new
TCell().setStringVal(storageMedium)); // STORAGE_MEDIUM
trow.addToColumnValue(new
TCell().setStringVal(TimeUtils.longToTimeString(dataProperty
.getCooldownTimeMs()))); // COOLDOWN_TIME_MS
trow.addToColumnValue(new
TCell().setStringVal(TimeUtils.longToTimeString(partition
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/common/proc/PartitionsProcDirTest.java
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/PartitionsProcDirTest.java
new file mode 100644
index 00000000000..15d11b3f57d
--- /dev/null
+++
b/fe/fe-core/src/test/java/org/apache/doris/common/proc/PartitionsProcDirTest.java
@@ -0,0 +1,61 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.proc;
+
+import org.apache.doris.common.Config;
+import org.apache.doris.common.FeConstants;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PartitionsProcDirTest {
+ private String originDeployMode;
+ private String originCloudUniqueId;
+
+ @Before
+ public void setUp() {
+ originDeployMode = Config.deploy_mode;
+ originCloudUniqueId = Config.cloud_unique_id;
+ Config.deploy_mode = "";
+ Config.cloud_unique_id = "";
+ }
+
+ @After
+ public void tearDown() {
+ Config.deploy_mode = originDeployMode;
+ Config.cloud_unique_id = originCloudUniqueId;
+ }
+
+ @Test
+ public void testDisplayInNonCloudMode() {
+ Assert.assertEquals("HDD",
PartitionsProcDir.getStorageMediumDisplay("HDD"));
+ Assert.assertEquals("tag.location.default: 1",
+
PartitionsProcDir.getReplicaAllocationDisplay("tag.location.default: 1"));
+ }
+
+ @Test
+ public void testDisplayInCloudMode() {
+ Config.deploy_mode = "cloud";
+ Assert.assertEquals(PartitionsProcDir.CLOUD_STORAGE_MEDIUM_DISPLAY,
+ PartitionsProcDir.getStorageMediumDisplay("HDD"));
+ Assert.assertEquals(FeConstants.null_string,
+
PartitionsProcDir.getReplicaAllocationDisplay("tag.location.default: 1"));
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]