diff --git a/ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java b/ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java index 616cc13dd5..0f5c6cb0de 100644 --- a/ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java +++ b/ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java @@ -68,6 +68,7 @@ import java.util.Arrays; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -423,12 +424,18 @@ public void getTablePartitions(Context ctx) { String catalog = ctx.pathParam("catalog"); String database = ctx.pathParam("db"); String table = ctx.pathParam("table"); + String filter = ctx.queryParamAsClass("filter", String.class).getOrDefault(""); Integer page = ctx.queryParamAsClass("page", Integer.class).getOrDefault(1); Integer pageSize = ctx.queryParamAsClass("pageSize", Integer.class).getOrDefault(20); List partitionBaseInfos = tableDescriptor.getTablePartition( TableIdentifier.of(catalog, database, table).buildTableIdentifier()); + partitionBaseInfos = + partitionBaseInfos.stream() + .filter(e -> e.getPartition().contains(filter)) + .sorted(Comparator.comparing(PartitionBaseInfo::getPartition).reversed()) + .collect(Collectors.toList()); int offset = (page - 1) * pageSize; PageResult amsPageResult = PageResult.of(partitionBaseInfos, offset, pageSize);