Repository: hive
Updated Branches:
  refs/heads/master 37e82baaf -> 524cd7948


HIVE-11023 : Disable directSQL if datanucleus.identifierFactory = datanucleus2 
(Sushanth Sowmyan, reviewed by Ashutosh Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/524cd794
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/524cd794
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/524cd794

Branch: refs/heads/master
Commit: 524cd7948d8c2b16a057e52608deeaa5fb9fa4ac
Parents: 37e82ba
Author: Sushanth Sowmyan <khorg...@gmail.com>
Authored: Wed Jun 17 16:34:07 2015 -0700
Committer: Sushanth Sowmyan <khorg...@gmail.com>
Committed: Wed Jun 17 16:39:33 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hive/metastore/MetaStoreDirectSql.java     | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/524cd794/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
----------------------------------------------------------------------
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
index ed810d2..1c21c8b 100644
--- 
a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
+++ 
b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java
@@ -128,10 +128,18 @@ class MetaStoreDirectSql {
     convertMapNullsToEmptyStrings =
         HiveConf.getBoolVar(conf, 
ConfVars.METASTORE_ORM_RETRIEVE_MAPNULLS_AS_EMPTY_STRINGS);
 
-    this.isCompatibleDatastore = ensureDbInit() && runTestQuery();
-    if (isCompatibleDatastore) {
-      LOG.info("Using direct SQL, underlying DB is " + dbType);
+    String jdoIdFactory = HiveConf.getVar(conf, 
ConfVars.METASTORE_IDENTIFIER_FACTORY);
+    if (! ("datanucleus1".equalsIgnoreCase(jdoIdFactory))){
+      LOG.warn("Underlying metastore does not use 'datanuclues1' for its ORM 
naming scheme."
+          + " Disabling directSQL as it uses hand-hardcoded SQL with that 
assumption.");
+      isCompatibleDatastore = false;
+    } else {
+      isCompatibleDatastore = ensureDbInit() && runTestQuery();
+      if (isCompatibleDatastore) {
+        LOG.info("Using direct SQL, underlying DB is " + dbType);
+      }
     }
+
     isAggregateStatsCacheEnabled = HiveConf.getBoolVar(conf, 
ConfVars.METASTORE_AGGREGATE_STATS_CACHE_ENABLED);
     if (isAggregateStatsCacheEnabled) {
       aggrStatsCache = AggregateStatsCache.getInstance(conf);

Reply via email to