You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by gs...@apache.org on 2022/12/02 05:49:20 UTC

[hive] branch master updated: HIVE-26767: Fix HIVE-24120 to work for custom databases (#3799) (authored by Tthrope reviewed by Sai Hemanth)

This is an automated email from the ASF dual-hosted git repository.

gsaihemanth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new acfaa90b7e7 HIVE-26767: Fix HIVE-24120 to work for custom databases (#3799) (authored by Tthrope reviewed by Sai Hemanth)
acfaa90b7e7 is described below

commit acfaa90b7e73d1d787ebf8f489b5312a2a86e508
Author: tthorpeIBM <tt...@ca.ibm.com>
AuthorDate: Fri Dec 2 00:49:10 2022 -0500

    HIVE-26767: Fix HIVE-24120 to work for custom databases (#3799) (authored by Tthrope reviewed by Sai Hemanth)
    
    * Fix HIVE-24120 to work for custom databases
    * HIVE-26767: Add omitted null configuration check
---
 .../org/apache/hadoop/hive/metastore/DatabaseProduct.java  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java
index 8418e59cf1f..0c1511b5c58 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DatabaseProduct.java
@@ -77,8 +77,16 @@ public class DatabaseProduct implements Configurable {
       Configuration conf) {
     DbType dbt;
 
+    Preconditions.checkNotNull(conf, "Configuration is null");
+    // Check if we are using an external database product
+    boolean isExternal = MetastoreConf.getBoolVar(conf, ConfVars.USE_CUSTOM_RDBMS);
+
     if (theDatabaseProduct != null) {
-      Preconditions.checkState(theDatabaseProduct.dbType == getDbType(productName));
+      dbt = getDbType(productName);
+      if (isExternal) {
+        dbt = DbType.CUSTOM;
+      }
+      Preconditions.checkState(theDatabaseProduct.dbType == dbt);
       return theDatabaseProduct;
     }
 
@@ -93,10 +101,6 @@ public class DatabaseProduct implements Configurable {
 
       // Check for null again in case of race condition
       if (theDatabaseProduct == null) {
-        Preconditions.checkNotNull(conf, "Configuration is null");
-        // Check if we are using an external database product
-        boolean isExternal = MetastoreConf.getBoolVar(conf, ConfVars.USE_CUSTOM_RDBMS);
-
         if (isExternal) {
           // The DatabaseProduct will be created by instantiating an external class via
           // reflection. The external class can override any method in the current class