This is an automated email from the ASF dual-hosted git repository.
jinsongzhou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 630111a89 [AMORO-3245] Display comment on Table page. (#3672)
630111a89 is described below
commit 630111a896ce095c65c75dc858655bc35cbf178d
Author: zhangwl9 <[email protected]>
AuthorDate: Thu Jul 31 20:44:27 2025 +0800
[AMORO-3245] Display comment on Table page. (#3672)
* Display comment in Tables page.
* fixup comment display
---------
Co-authored-by: 张文领 <[email protected]>
---
.../server/dashboard/MixedAndIcebergTableDescriptor.java | 12 ++++++++----
.../apache/amoro/table/descriptor/ServerTableMeta.java | 16 ++++++++++++++--
.../apache/amoro/formats/hudi/HudiTableDescriptor.java | 10 +++++++++-
.../java/org/apache/amoro/table/TableProperties.java | 3 +++
.../amoro/formats/paimon/PaimonTableDescriptor.java | 3 +++
amoro-web/src/types/common.type.ts | 1 +
amoro-web/src/views/tables/components/Details.vue | 4 +++-
amoro-web/src/views/tables/index.vue | 6 +++++-
8 files changed, 46 insertions(+), 9 deletions(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java
b/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java
index ac1fb6076..c5c5c23a0 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java
@@ -706,7 +706,13 @@ public class MixedAndIcebergTableDescriptor extends
PersistentBase
serverTableMeta.setTableType(table.format().toString());
serverTableMeta.setTableIdentifier(table.id());
serverTableMeta.setBaseLocation(table.location());
- fillTableProperties(serverTableMeta, table.properties());
+ Map<String, String> tableProperties = Maps.newHashMap(table.properties());
+ fillTableProperties(serverTableMeta, tableProperties);
+ if (tableProperties.containsKey(TableProperties.COMMENT)) {
+ String comment = tableProperties.get(TableProperties.COMMENT);
+ serverTableMeta.setComment(comment);
+ }
+
serverTableMeta.setPartitionColumnList(
table.spec().fields().stream()
.map(item ->
buildPartitionFieldFromPartitionSpec(table.spec().schema(), item))
@@ -732,13 +738,11 @@ public class MixedAndIcebergTableDescriptor extends
PersistentBase
.filter(s ->
table.schema().identifierFieldNames().contains(s.getField()))
.collect(Collectors.toList()));
}
-
return serverTableMeta;
}
private void fillTableProperties(
- ServerTableMeta serverTableMeta, Map<String, String> tableProperties) {
- Map<String, String> properties = Maps.newHashMap(tableProperties);
+ ServerTableMeta serverTableMeta, Map<String, String> properties) {
serverTableMeta.setTableWatermark(properties.remove(TableProperties.WATERMARK_TABLE));
serverTableMeta.setBaseWatermark(properties.remove(TableProperties.WATERMARK_BASE_STORE));
serverTableMeta.setCreateTime(
diff --git
a/amoro-common/src/main/java/org/apache/amoro/table/descriptor/ServerTableMeta.java
b/amoro-common/src/main/java/org/apache/amoro/table/descriptor/ServerTableMeta.java
index 910b74bac..6b250f38f 100644
---
a/amoro-common/src/main/java/org/apache/amoro/table/descriptor/ServerTableMeta.java
+++
b/amoro-common/src/main/java/org/apache/amoro/table/descriptor/ServerTableMeta.java
@@ -43,6 +43,8 @@ public class ServerTableMeta {
private String tableWatermark;
private String baseWatermark;
+ // table comment
+ private String comment;
public ServerTableMeta() {}
@@ -166,6 +168,14 @@ public class ServerTableMeta {
this.tableSummary = tableSummary;
}
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -179,12 +189,13 @@ public class ServerTableMeta {
&& Objects.equals(schema, that.schema)
&& Objects.equals(pkList, that.pkList)
&& Objects.equals(partitionColumnList, that.partitionColumnList)
- && Objects.equals(properties, that.properties);
+ && Objects.equals(properties, that.properties)
+ && Objects.equals(comment, that.comment);
}
@Override
public int hashCode() {
- return Objects.hash(tableIdentifier, schema, pkList, partitionColumnList,
properties);
+ return Objects.hash(tableIdentifier, schema, pkList, partitionColumnList,
properties, comment);
}
@Override
@@ -195,6 +206,7 @@ public class ServerTableMeta {
.add("pkList", pkList)
.add("partitionColumnList", partitionColumnList)
.add("properties", properties)
+ .add("comment", comment)
.toString();
}
}
diff --git
a/amoro-format-hudi/src/main/java/org/apache/amoro/formats/hudi/HudiTableDescriptor.java
b/amoro-format-hudi/src/main/java/org/apache/amoro/formats/hudi/HudiTableDescriptor.java
index 0a50afb30..04d089233 100644
---
a/amoro-format-hudi/src/main/java/org/apache/amoro/formats/hudi/HudiTableDescriptor.java
+++
b/amoro-format-hudi/src/main/java/org/apache/amoro/formats/hudi/HudiTableDescriptor.java
@@ -97,6 +97,8 @@ public class HudiTableDescriptor implements
FormatTableDescriptor {
private static final Logger LOG =
LoggerFactory.getLogger(HudiTableDescriptor.class);
private static final String COMPACTION = "compaction";
private static final String CLUSTERING = "clustering";
+ // table comment
+ private static final String COMMENT = "comment";
private ExecutorService ioExecutors;
@@ -140,7 +142,13 @@ public class HudiTableDescriptor implements
FormatTableDescriptor {
Map<String, AMSColumnInfo> columnMap =
columns.stream().collect(Collectors.toMap(AMSColumnInfo::getField,
Function.identity()));
meta.setSchema(columns);
- meta.setProperties(amoroTable.properties());
+ Map<String, String> tableProperties =
Maps.newHashMap(amoroTable.properties());
+ meta.setProperties(tableProperties);
+ if (tableProperties.containsKey(COMMENT)) {
+ String comment = tableProperties.get(COMMENT);
+ meta.setComment(comment);
+ }
+
meta.setBaseLocation(metaClient.getBasePathV2().toString());
if (hoodieTableConfig.isTablePartitioned()) {
diff --git
a/amoro-format-iceberg/src/main/java/org/apache/amoro/table/TableProperties.java
b/amoro-format-iceberg/src/main/java/org/apache/amoro/table/TableProperties.java
index 08f2ed242..3da2922ea 100644
---
a/amoro-format-iceberg/src/main/java/org/apache/amoro/table/TableProperties.java
+++
b/amoro-format-iceberg/src/main/java/org/apache/amoro/table/TableProperties.java
@@ -42,6 +42,9 @@ public class TableProperties {
public static final String TABLE_CREATE_TIME = "table.create-timestamp";
public static final long TABLE_CREATE_TIME_DEFAULT = 0L;
+ /** table comment related properties */
+ public static final String COMMENT = "comment";
+
/** table watermark related properties */
public static final String TABLE_EVENT_TIME_FIELD = "table.event-time-field";
diff --git
a/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonTableDescriptor.java
b/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonTableDescriptor.java
index 534501af3..f93827658 100644
---
a/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonTableDescriptor.java
+++
b/amoro-format-paimon/src/main/java/org/apache/amoro/formats/paimon/PaimonTableDescriptor.java
@@ -141,6 +141,9 @@ public class PaimonTableDescriptor implements
FormatTableDescriptor {
Map<String, Object> baseMetric = new HashMap<>();
// table summary
TableSummary tableSummary;
+ if (table.comment().isPresent()) {
+ serverTableMeta.setComment(table.comment().get());
+ }
Snapshot snapshot = store.snapshotManager().latestSnapshot();
if (snapshot != null) {
AmoroSnapshotsOfTable snapshotsOfTable =
diff --git a/amoro-web/src/types/common.type.ts
b/amoro-web/src/types/common.type.ts
index 049a74aed..75cd5b319 100644
--- a/amoro-web/src/types/common.type.ts
+++ b/amoro-web/src/types/common.type.ts
@@ -70,6 +70,7 @@ export interface IBaseDetailInfo {
tableFormat: string
hasPartition: boolean
healthScore: number
+ comment: string
}
export interface ResourceUsageItem {
diff --git a/amoro-web/src/views/tables/components/Details.vue
b/amoro-web/src/views/tables/components/Details.vue
index a4caa6b11..fd576bf8c 100644
--- a/amoro-web/src/views/tables/components/Details.vue
+++ b/amoro-web/src/views/tables/components/Details.vue
@@ -68,6 +68,7 @@ const state = reactive({
createTime: '',
tableFormat: '',
hasPartition: false, // Whether there is a partition, if there is no
partition, the file list will be displayed
+ comment: ''
} as IBaseDetailInfo,
pkList: [] as DetailColumnItem[],
partitionColumnList: [] as PartitionColumnItem[],
@@ -87,13 +88,14 @@ async function getTableDetails() {
const result = await getTableDetail({
...params.value,
})
- const { pkList = [], tableType, partitionColumnList = [], properties,
changeMetrics, schema, createTime, tableIdentifier, baseMetrics, tableSummary }
= result
+ const { pkList = [], tableType, partitionColumnList = [], properties,
changeMetrics, schema, createTime, tableIdentifier, baseMetrics, tableSummary,
comment } = result
state.baseDetailInfo = {
...tableSummary,
tableType,
tableName: `${tableIdentifier?.catalog ||
''}.${tableIdentifier?.database || ''}.${tableIdentifier?.tableName || ''}`,
createTime: createTime ? dateFormat(createTime) : '',
hasPartition: !!(partitionColumnList?.length),
+ comment: comment || ''
}
state.pkList = pkList || []
diff --git a/amoro-web/src/views/tables/index.vue
b/amoro-web/src/views/tables/index.vue
index 18fa8fca7..9a5dea096 100644
--- a/amoro-web/src/views/tables/index.vue
+++ b/amoro-web/src/views/tables/index.vue
@@ -61,6 +61,7 @@ export default defineComponent({
tableFormat: '',
hasPartition: false,
healthScore: -1,
+ comment: ''
} as IBaseDetailInfo,
detailLoaded: false,
})
@@ -69,7 +70,7 @@ export default defineComponent({
return state.baseInfo.tableType === 'ICEBERG'
})
- const setBaseDetailInfo = (baseInfo: IBaseDetailInfo) => {
+ const setBaseDetailInfo = (baseInfo: IBaseDetailInfo & { comment?: string
}) => {
state.detailLoaded = true
state.baseInfo = { ...baseInfo }
}
@@ -142,6 +143,9 @@ export default defineComponent({
<div class="g-flex">
<span :title="baseInfo.tableName" class="table-name
g-text-nowrap">{{ baseInfo.tableName }}</span>
</div>
+ <div v-if="baseInfo.comment" class="table-info g-flex-ac">
+ <p>{{ $t('Comment') }}: <span class="text-color">{{
baseInfo.comment }}</span></p>
+ </div>
<div class="table-info g-flex-ac">
<p>{{ $t('optimizingStatus') }}: <span class="text-color">{{
baseInfo.optimizingStatus }}</span></p>
<a-divider type="vertical" />