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-2260] Show the format version of iceberg table #2425

Merged
merged 2 commits into from
Dec 14, 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 @@ -53,6 +53,7 @@
import com.netease.arctic.utils.ArcticDataFiles;
import org.apache.commons.collections.CollectionUtils;
import org.apache.iceberg.ContentFile;
import org.apache.iceberg.HasTableOperations;
import org.apache.iceberg.IcebergFindFiles;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Snapshot;
Expand Down Expand Up @@ -102,6 +103,7 @@
@Override
public ServerTableMeta getTableDetail(AmoroTable<?> amoroTable) {
ArcticTable table = getTable(amoroTable);
String tableFormat = decorateTableFormat(amoroTable);

Check warning on line 106 in ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java#L106

Added line #L106 was not covered by tests
// set basic info
TableBasicInfo tableBasicInfo = getTableBasicInfo(table);
ServerTableMeta serverTableMeta = getServerTableMeta(table);
Expand Down Expand Up @@ -150,11 +152,24 @@
tableSummary.put("size", byteToXB(tableSize));
tableSummary.put("file", tableFileCnt);
tableSummary.put("averageFile", byteToXB(tableFileCnt == 0 ? 0 : tableSize / tableFileCnt));
tableSummary.put("tableFormat", AmsUtil.formatString(amoroTable.format().name()));
tableSummary.put("tableFormat", tableFormat);

Check warning on line 155 in ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java#L155

Added line #L155 was not covered by tests
serverTableMeta.setTableSummary(tableSummary);
return serverTableMeta;
}

private String decorateTableFormat(AmoroTable table) {
StringBuilder sb = new StringBuilder();
sb.append(AmsUtil.formatString(table.format().name()));

Check warning on line 162 in ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java#L161-L162

Added lines #L161 - L162 were not covered by tests
if (table.format().equals(TableFormat.ICEBERG)) {
int formatVersion =
((HasTableOperations) table.originalTable()).operations().current().formatVersion();
sb.append("(V");
sb.append(formatVersion);
sb.append(")");

Check warning on line 168 in ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java#L164-L168

Added lines #L164 - L168 were not covered by tests
}
return sb.toString();

Check warning on line 170 in ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java

View check run for this annotation

Codecov / codecov/patch

ams/server/src/main/java/com/netease/arctic/server/dashboard/MixedAndIcebergTableDescriptor.java#L170

Added line #L170 was not covered by tests
}

private Long snapshotIdOfTableRef(Table table, String ref) {
if (ref == null) {
ref = SnapshotRef.MAIN_BRANCH;
Expand Down