Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMORO-2316] The Files page supports filtering by partition name and sorting by dictionary value #2343

Merged
merged 5 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -423,12 +424,18 @@
String catalog = ctx.pathParam("catalog");
String database = ctx.pathParam("db");
String table = ctx.pathParam("table");
String filter = ctx.queryParamAsClass("filter", String.class).getOrDefault("");

Check warning on line 427 in ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java#L427

Added line #L427 was not covered by tests
Integer page = ctx.queryParamAsClass("page", Integer.class).getOrDefault(1);
Integer pageSize = ctx.queryParamAsClass("pageSize", Integer.class).getOrDefault(20);

List<PartitionBaseInfo> 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());

Check warning on line 438 in ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/controller/TableController.java#L434-L438

Added lines #L434 - L438 were not covered by tests
int offset = (page - 1) * pageSize;
PageResult<PartitionBaseInfo> amsPageResult =
PageResult.of(partitionBaseInfos, offset, pageSize);
Expand Down