This is an automated email from the ASF dual-hosted git repository.
hello-stephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9688e57f280 [fix](cloud) normalize SHOW PARTITIONS display for storage
and replica (#60871)
9688e57f280 is described below
commit 9688e57f280da153268779603f0470c5c340960d
Author: deardeng <[email protected]>
AuthorDate: Fri May 29 10:54:37 2026 +0800
[fix](cloud) normalize SHOW PARTITIONS display for storage and replica
(#60871)
In cloud mode, SHOW PARTITIONS now displays StorageMedium as
OBJECT_STORAGE and ReplicaAllocation as <null>. Also add
PartitionsProcDirTest to cover cloud/non-cloud display behavior.
<img width="462" height="312" alt="image"
src="https://github.com/user-attachments/assets/f5ac8ab8-3ffd-468c-a2ea-9a957e7e385a"
/>
---
.../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 e78ee750d37..4bf00c0be67 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
@@ -105,6 +105,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")
@@ -409,6 +410,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;
@@ -580,8 +589,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));
@@ -600,7 +610,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 196445b588c..fa82795e065 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
@@ -1922,15 +1922,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]