Skip to content

Commit

Permalink
[AMORO-3021]: AMS First Time Async Load External Catalog Select Optim…
Browse files Browse the repository at this point in the history
…izingStatus Have NPE (#3021)  (#3022)

[AMORO-3021]: AMS First Time Async Load External Catalog Select OptimizingStatus Have NPE (#3021)

Co-authored-by: ConradJam <[email protected]>
  • Loading branch information
czy006 and ConradJam authored Jul 10, 2024
1 parent 28cd125 commit dcfbc36
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.apache.amoro.server.dashboard.response.PageResult;
import org.apache.amoro.server.dashboard.utils.AmsUtil;
import org.apache.amoro.server.dashboard.utils.CommonUtil;
import org.apache.amoro.server.optimizing.OptimizingStatus;
import org.apache.amoro.server.table.TableRuntime;
import org.apache.amoro.server.table.TableService;
import org.apache.amoro.shade.guava32.com.google.common.base.Function;
Expand All @@ -80,6 +81,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
Expand Down Expand Up @@ -137,13 +139,18 @@ public void getTableDetail(Context ctx) {
ServerTableMeta serverTableMeta =
tableDescriptor.getTableDetail(
TableIdentifier.of(catalog, database, tableName).buildTableIdentifier());
ServerTableIdentifier serverTableIdentifier =
tableService.getServerTableIdentifier(
TableIdentifier.of(catalog, database, tableName).buildTableIdentifier());
Map<String, Object> tableSummary = serverTableMeta.getTableSummary();
tableSummary.put(
"optimizingStatus", tableService.getRuntime(serverTableIdentifier).getOptimizingStatus());

Optional<ServerTableIdentifier> serverTableIdentifier =
Optional.ofNullable(
tableService.getServerTableIdentifier(
TableIdentifier.of(catalog, database, tableName).buildTableIdentifier()));
if (serverTableIdentifier.isPresent()) {
tableSummary.put(
"optimizingStatus",
tableService.getRuntime(serverTableIdentifier.get()).getOptimizingStatus());
} else {
tableSummary.put("optimizingStatus", OptimizingStatus.IDLE);
}
ctx.json(OkResponse.of(serverTableMeta));
}

Expand Down

0 comments on commit dcfbc36

Please sign in to comment.