From e57f9253b817adf025b26170466990d456b56ee1 Mon Sep 17 00:00:00 2001 From: shendanfeng Date: Tue, 21 Nov 2023 15:21:35 +0800 Subject: [PATCH 1/3] fix-2316 --- .../server/dashboard/controller/TableController.java | 7 +++++++ 1 file changed, 7 insertions(+) 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..29217bd24c 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 keywords = ctx.queryParamAsClass("keywords", 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(keywords)) + .sorted(Comparator.comparing(PartitionBaseInfo::getPartition).reversed()) + .collect(Collectors.toList()); int offset = (page - 1) * pageSize; PageResult amsPageResult = PageResult.of(partitionBaseInfos, offset, pageSize); From 9b0f9e3a666a6136ff4338c8ee4e59c803d4c7aa Mon Sep 17 00:00:00 2001 From: shendanfeng Date: Thu, 23 Nov 2023 14:56:52 +0800 Subject: [PATCH 2/3] fix-2316 --- .../arctic/server/dashboard/controller/TableController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 29217bd24c..fe559f072b 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 @@ -424,7 +424,7 @@ public void getTablePartitions(Context ctx) { String catalog = ctx.pathParam("catalog"); String database = ctx.pathParam("db"); String table = ctx.pathParam("table"); - String keywords = ctx.queryParamAsClass("keywords", String.class).getOrDefault(""); + String keywords = ctx.queryParamAsClass("filter", String.class).getOrDefault(""); Integer page = ctx.queryParamAsClass("page", Integer.class).getOrDefault(1); Integer pageSize = ctx.queryParamAsClass("pageSize", Integer.class).getOrDefault(20); From a102916712bfe342007f8d108c95ae7898a2d4e5 Mon Sep 17 00:00:00 2001 From: shendanfeng Date: Thu, 23 Nov 2023 15:13:13 +0800 Subject: [PATCH 3/3] change param name --- .../arctic/server/dashboard/controller/TableController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 fe559f072b..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 @@ -424,7 +424,7 @@ public void getTablePartitions(Context ctx) { String catalog = ctx.pathParam("catalog"); String database = ctx.pathParam("db"); String table = ctx.pathParam("table"); - String keywords = ctx.queryParamAsClass("filter", String.class).getOrDefault(""); + 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); @@ -433,7 +433,7 @@ public void getTablePartitions(Context ctx) { TableIdentifier.of(catalog, database, table).buildTableIdentifier()); partitionBaseInfos = partitionBaseInfos.stream() - .filter(e -> e.getPartition().contains(keywords)) + .filter(e -> e.getPartition().contains(filter)) .sorted(Comparator.comparing(PartitionBaseInfo::getPartition).reversed()) .collect(Collectors.toList()); int offset = (page - 1) * pageSize;