From b407eea5004ff0ab360dd03058f07607a3709d94 Mon Sep 17 00:00:00 2001 From: Aireed Date: Fri, 3 Jan 2025 11:32:55 +0800 Subject: [PATCH] [improvement]support add comment to hive table --- .../org/apache/amoro/hive/catalog/MixedHiveTables.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/catalog/MixedHiveTables.java b/amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/catalog/MixedHiveTables.java index d4ac4a8c9e..bf07b2f37e 100644 --- a/amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/catalog/MixedHiveTables.java +++ b/amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/catalog/MixedHiveTables.java @@ -59,6 +59,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import java.util.Optional; public class MixedHiveTables { @@ -510,6 +511,11 @@ private org.apache.hadoop.hive.metastore.api.Table newHiveTable( TableMeta meta, Schema schema, PartitionSpec partitionSpec) { final long currentTimeMillis = System.currentTimeMillis(); + // set table comment here! + Map parameters = new HashMap<>(); + Optional comment = Optional.ofNullable(meta.getProperties().get("comment")); + comment.ifPresent(val -> parameters.put("comment", val)); + org.apache.hadoop.hive.metastore.api.Table newTable = new org.apache.hadoop.hive.metastore.api.Table( meta.getTableIdentifier().getTableName(), @@ -521,7 +527,7 @@ private org.apache.hadoop.hive.metastore.api.Table newHiveTable( Integer.MAX_VALUE, null, HiveSchemaUtil.hivePartitionFields(schema, partitionSpec), - new HashMap<>(), + parameters, null, null, TableType.EXTERNAL_TABLE.toString());