This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 8510af3a7f [fix](hive external) support set hive version when create
hive external table (#20622)
8510af3a7f is described below
commit 8510af3a7f49d0c6e90ad9ff8a267fa905936656
Author: Chuang Li <[email protected]>
AuthorDate: Sun Sep 3 11:16:46 2023 +0800
[fix](hive external) support set hive version when create hive external
table (#20622)
---
fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java | 6 ++++++
.../main/java/org/apache/doris/datasource/InternalCatalog.java | 3 +++
.../src/test/java/org/apache/doris/catalog/HiveTableTest.java | 8 ++++++++
3 files changed, 17 insertions(+)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java
b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java
index 9f9dadbbe7..550be96f74 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/HiveTable.java
@@ -106,6 +106,12 @@ public class HiveTable extends Table {
}
copiedProps.remove(HMSProperties.HIVE_METASTORE_URIS);
hiveProperties.put(HMSProperties.HIVE_METASTORE_URIS,
hiveMetaStoreUris);
+ // support multi hive version
+ String hiveVersion = copiedProps.get(HMSProperties.HIVE_VERSION);
+ if (!Strings.isNullOrEmpty(hiveVersion)) {
+ copiedProps.remove(HMSProperties.HIVE_VERSION);
+ hiveProperties.put(HMSProperties.HIVE_VERSION, hiveVersion);
+ }
// check auth type
String authType =
copiedProps.get(HdfsResource.HADOOP_SECURITY_AUTHENTICATION);
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
index 885e932a86..30837fb685 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java
@@ -2651,6 +2651,9 @@ public class InternalCatalog implements
CatalogIf<Database> {
HiveConf hiveConf = new HiveConf();
hiveConf.set(HMSProperties.HIVE_METASTORE_URIS,
hiveTable.getHiveProperties().get(HMSProperties.HIVE_METASTORE_URIS));
+ if
(!Strings.isNullOrEmpty(hiveTable.getHiveProperties().get(HMSProperties.HIVE_VERSION)))
{
+ hiveConf.set(HMSProperties.HIVE_VERSION,
hiveTable.getHiveProperties().get(HMSProperties.HIVE_VERSION));
+ }
PooledHiveMetaStoreClient client = new
PooledHiveMetaStoreClient(hiveConf, 1);
if (!client.tableExists(hiveTable.getHiveDb(),
hiveTable.getHiveTable())) {
throw new DdlException(String.format("Table [%s] dose not exist in
Hive.", hiveTable.getHiveDbTable()));
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/HiveTableTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/HiveTableTest.java
index 983cd2736e..abfcc68790 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/HiveTableTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/HiveTableTest.java
@@ -18,6 +18,7 @@
package org.apache.doris.catalog;
import org.apache.doris.common.DdlException;
+import org.apache.doris.datasource.property.constants.HMSProperties;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@@ -77,4 +78,11 @@ public class HiveTableTest {
new HiveTable(1000, "hive_table", columns, properties);
Assert.fail("No exception throws.");
}
+
+ @Test()
+ public void testVersion() throws DdlException {
+ properties.put(HMSProperties.HIVE_VERSION, "2.1.2");
+ HiveTable table = new HiveTable(1000, "hive_table", columns,
properties);
+ Assert.assertEquals("2.1.2",
table.getHiveProperties().get(HMSProperties.HIVE_VERSION));
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]