This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new fa1f3732b [hive] alter table option support sync all properties to hms
(#3979)
fa1f3732b is described below
commit fa1f3732ba4c99732855d012a9f66e05bd2716dc
Author: herefree <[email protected]>
AuthorDate: Fri Aug 16 18:43:50 2024 +0800
[hive] alter table option support sync all properties to hms (#3979)
---
.../java/org/apache/paimon/hive/HiveCatalog.java | 7 +++++-
.../apache/paimon/hive/HiveCatalogITCaseBase.java | 28 ++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
index 58289b179..0cd834f8e 100644
---
a/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
+++
b/paimon-hive/paimon-hive-catalog/src/main/java/org/apache/paimon/hive/HiveCatalog.java
@@ -802,7 +802,12 @@ public class HiveCatalog extends AbstractCatalog {
}
private void updateHmsTablePars(Table table, TableSchema schema) {
-
table.getParameters().putAll(convertToPropertiesPrefixKey(schema.options(),
HIVE_PREFIX));
+ if (syncAllProperties()) {
+ table.getParameters().putAll(schema.options());
+ } else {
+ table.getParameters()
+ .putAll(convertToPropertiesPrefixKey(schema.options(),
HIVE_PREFIX));
+ }
}
@VisibleForTesting
diff --git
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
index e3fc2f6b1..e84f9395f 100644
---
a/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
+++
b/paimon-hive/paimon-hive-connector-common/src/test/java/org/apache/paimon/hive/HiveCatalogITCaseBase.java
@@ -389,6 +389,20 @@ public abstract class HiveCatalogITCaseBase {
.contains("\tfile.format \tavro
"))
.isTrue();
+ tEnv.executeSql("ALTER TABLE t01 SET ( 'file.format' = 'parquet'
)").await();
+ assertThat(
+ hiveShell
+ .executeQuery("DESC FORMATTED t01")
+ .contains("\tfile.format \tparquet
"))
+ .isTrue();
+
+ tEnv.executeSql("ALTER TABLE t01 SET ('owner' = 'hive')").await();
+ assertThat(
+ hiveShell
+ .executeQuery("DESC FORMATTED t01")
+ .contains("\towner \thive
"))
+ .isTrue();
+
tEnv.executeSql(
String.join(
"\n",
@@ -413,6 +427,20 @@ public abstract class HiveCatalogITCaseBase {
.executeQuery("DESC FORMATTED t02")
.contains("\tfile.format \tavro
"))
.isFalse();
+
+ tEnv.executeSql("ALTER TABLE t02 SET ( 'file.format' = 'parquet'
)").await();
+ assertThat(
+ hiveShell
+ .executeQuery("DESC FORMATTED t02")
+ .contains("\tfile.format \tparquet
"))
+ .isFalse();
+
+ tEnv.executeSql("ALTER TABLE t02 SET ('owner' = 'hive')").await();
+ assertThat(
+ hiveShell
+ .executeQuery("DESC FORMATTED t02")
+ .contains("\towner \thive
"))
+ .isFalse();
}
@Test