You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/14 05:59:05 UTC
[doris] 09/12: [Improvement](multi catalog)Add comment to external hms table show create table output. (#14861)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0a54885a7c7826b00c31f89e37f09dd50e7066dd
Author: Jibing-Li <64...@users.noreply.github.com>
AuthorDate: Wed Dec 7 21:12:30 2022 +0800
[Improvement](multi catalog)Add comment to external hms table show create table output. (#14861)
The output of show create table comment for hms external table doesn't contain comment section.
This pr is to add the comment to the output.
---
.../apache/doris/catalog/HiveMetaStoreClientHelper.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
index be75a1c983..e3aad211d6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveMetaStoreClientHelper.java
@@ -96,6 +96,7 @@ public class HiveMetaStoreClientHelper {
public static final String HIVE_METASTORE_URIS = "hive.metastore.uris";
public static final String HIVE_METASTORE_TYPE = "hive.metastore.type";
public static final String DLF_TYPE = "dlf";
+ public static final String COMMENT = "comment";
private static final Pattern digitPattern = Pattern.compile("(\\d+)");
@@ -835,6 +836,9 @@ public class HiveMetaStoreClientHelper {
}
}
output.append(")\n");
+ if (remoteTable.getParameters().containsKey(COMMENT)) {
+ output.append(String.format("COMMENT '%s'", remoteTable.getParameters().get(COMMENT))).append("\n");
+ }
if (remoteTable.getPartitionKeys().size() > 0) {
output.append("PARTITIONED BY (\n")
.append(remoteTable.getPartitionKeys().stream().map(
@@ -869,7 +873,15 @@ public class HiveMetaStoreClientHelper {
}
if (remoteTable.isSetParameters()) {
output.append("TBLPROPERTIES (\n");
- Iterator<Map.Entry<String, String>> params = remoteTable.getParameters().entrySet().iterator();
+ Map<String, String> parameters = Maps.newHashMap();
+ // Copy the parameters to a new Map to keep them unchanged.
+ parameters.putAll(remoteTable.getParameters());
+ if (parameters.containsKey(COMMENT)) {
+ // Comment is always added to the end of remote table parameters.
+ // It has already showed above in COMMENT section, so remove it here.
+ parameters.remove(COMMENT);
+ }
+ Iterator<Map.Entry<String, String>> params = parameters.entrySet().iterator();
while (params.hasNext()) {
Map.Entry<String, String> param = params.next();
output.append(String.format(" '%s'='%s'", param.getKey(), param.getValue()));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org