You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2018/12/05 21:54:47 UTC

[4/8] trafodion git commit: [TRAFODION-3234] Refactor hive meta calls to be less resource intensive to support hive partitions if needed

[TRAFODION-3234] Refactor hive meta calls to be less resource intensive to support hive partitions if needed

Possible fix for check-PR failures.


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/7633327b
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/7633327b
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/7633327b

Branch: refs/heads/master
Commit: 7633327b43cc51d49c622e9854384bd553e435ab
Parents: bfd7a8f
Author: selvaganesang <se...@esgyn.com>
Authored: Fri Nov 30 23:50:10 2018 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Fri Nov 30 23:50:10 2018 +0000

----------------------------------------------------------------------
 core/sql/executor/HiveClient_JNI.cpp            | 34 +++++++++++---------
 core/sql/sqlcomp/CmpDescribe.cpp                |  5 ++-
 .../main/java/org/trafodion/sql/HiveClient.java |  1 -
 3 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/7633327b/core/sql/executor/HiveClient_JNI.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/HiveClient_JNI.cpp b/core/sql/executor/HiveClient_JNI.cpp
index 26dfc87..1c67320 100644
--- a/core/sql/executor/HiveClient_JNI.cpp
+++ b/core/sql/executor/HiveClient_JNI.cpp
@@ -40,6 +40,7 @@ pthread_mutex_t HiveClient_JNI::javaMethodsInitMutex_ = PTHREAD_MUTEX_INITIALIZE
 static const char* const hvcErrorEnumStr[] = 
 {
   "Preparing parameters for HiveClient."
+ ,"Java exception in init()."
  ,"Java exception in close()."
  ,"Preparing parameters for exists()."
  ,"Java exception in exists()."
@@ -53,6 +54,7 @@ static const char* const hvcErrorEnumStr[] =
  ,"Preparing parameters for getHiveTableInfo()."
  ,"Java exception in getHiveTableInfo()."
  ,"Error in getHiveTableInfoDetails()."
+ ,"Error during populdate SDs."
 };
 
 
@@ -130,7 +132,7 @@ void HiveClient_JNI::deleteInstance()
 HiveClient_JNI::~HiveClient_JNI()
 {
    cleanupTableInfo();
-   if (isInitialized())	
+   if (isConnected_)	
       close(); // error handling
 }
 
@@ -189,7 +191,7 @@ HVC_RetCode HiveClient_JNI::init()
 //////////////////////////////////////////////////////////////////////////////
 HVC_RetCode HiveClient_JNI::initConnection()
 { 
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HiveClient_JNI::initConnection(%s) called.");
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HiveClient_JNI::initConnection(%s) called.");
 
 
   if (initJNIEnv() != JOI_OK)
@@ -209,7 +211,7 @@ HVC_RetCode HiveClient_JNI::initConnection()
 
   if (jresult == false) 
   {
-    logError(CAT_SQL_HBASE, "HiveClient_JNI::initConnection()", getLastError());
+    logError(CAT_SQL_HDFS, "HiveClient_JNI::initConnection()", getLastError());
     jenv_->PopLocalFrame(NULL);
     return HVC_ERROR_INIT_EXCEPTION;
   }
@@ -225,7 +227,7 @@ HVC_RetCode HiveClient_JNI::initConnection()
 //////////////////////////////////////////////////////////////////////////////
 HVC_RetCode HiveClient_JNI::exists(const char* schName, const char* tabName)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HiveClient_JNI::exists(%s, %s) called.", schName, tabName);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HiveClient_JNI::exists(%s, %s) called.", schName, tabName);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   if (getInstance() == NULL)
@@ -272,7 +274,7 @@ HVC_RetCode HiveClient_JNI::getRedefTime(const char* schName,
                                          const char* tabName, 
                                          Int64& redefTime)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HiveClient_JNI::getRedefTime(%s, %s, %lld).", schName, tabName, redefTime);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Enter HiveClient_JNI::getRedefTime(%s, %s, %lld).", schName, tabName, redefTime);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   if (getInstance() == NULL)
@@ -306,7 +308,7 @@ HVC_RetCode HiveClient_JNI::getRedefTime(const char* schName,
     return HVC_ERROR_GET_REDEFTIME_EXCEPTION;
   }
 
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Exit HiveClient_JNI::getRedefTime(%s, %s, %lld).", schName, tabName, redefTime);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Exit HiveClient_JNI::getRedefTime(%s, %s, %lld).", schName, tabName, redefTime);
 
   if (jresult < 0) {
     jenv_->PopLocalFrame(NULL);
@@ -324,7 +326,7 @@ HVC_RetCode HiveClient_JNI::getRedefTime(const char* schName,
 ////////////////////////////////////////////////////////////////////////////// 
 HVC_RetCode HiveClient_JNI::getAllSchemas(NAHeap *heap, LIST(Text *)& schNames)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HiveClient_JNI::getAllSchemas(%p) called.", (void *) &schNames);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Enter HiveClient_JNI::getAllSchemas(%p) called.", (void *) &schNames);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   if (getInstance() == NULL)
@@ -347,7 +349,7 @@ HVC_RetCode HiveClient_JNI::getAllSchemas(NAHeap *heap, LIST(Text *)& schNames)
      jenv_->PopLocalFrame(NULL);
      return HVC_DONE;
   }
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, 
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, 
        "Exit HiveClient_JNI::getAllSchemas(%p) called.", (void *) &schNames);
   jenv_->PopLocalFrame(NULL);
   return HVC_OK;
@@ -358,7 +360,7 @@ HVC_RetCode HiveClient_JNI::getAllSchemas(NAHeap *heap, LIST(Text *)& schNames)
 ////////////////////////////////////////////////////////////////////////////// 
 HVC_RetCode HiveClient_JNI::executeHiveSQL(const char* hiveSQL)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HiveClient_JNI::executeHiveSQL(%s) called.", hiveSQL);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Enter HiveClient_JNI::executeHiveSQL(%s) called.", hiveSQL);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   if (getInstance() == NULL)
@@ -383,7 +385,7 @@ HVC_RetCode HiveClient_JNI::executeHiveSQL(const char* hiveSQL)
     return HVC_ERROR_EXECUTE_HIVE_SQL_EXCEPTION;
   }
 
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, 
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, 
        "Exit HiveClient_JNI::executeHiveSQL(%s) called.", hiveSQL);
   jenv_->PopLocalFrame(NULL);
   return HVC_OK;
@@ -395,7 +397,7 @@ HVC_RetCode HiveClient_JNI::executeHiveSQL(const char* hiveSQL)
 HVC_RetCode HiveClient_JNI::getAllTables(NAHeap *heap, const char* schName, 
                                          LIST(Text *)& tblNames)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HiveClient_JNI::getAllTables(%s, %p) called.", schName, (void *) &tblNames);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Enter HiveClient_JNI::getAllTables(%s, %p) called.", schName, (void *) &tblNames);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   if (getInstance() == NULL)
@@ -443,7 +445,7 @@ HVC_RetCode HiveClient_JNI::getAllTables(NAHeap *heap, const char* schName,
 //////////////////////////////////////////////////////////////////////////////	
 HVC_RetCode HiveClient_JNI::close()	
 {	
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HiveClient_JNI::close() called.");	
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "HiveClient_JNI::close() called.");	
 	
   if (initJNIEnv() != JOI_OK)	
      return HVC_ERROR_INIT_PARAM;	
@@ -460,7 +462,7 @@ HVC_RetCode HiveClient_JNI::close()
   	
   if (jresult == false) 	
   {	
-    logError(CAT_SQL_HBASE, "HiveClient_JNI::close()", getLastError());	
+    logError(CAT_SQL_HDFS, "HiveClient_JNI::close()", getLastError());	
     jenv_->PopLocalFrame(NULL);	
     return HVC_ERROR_CLOSE_EXCEPTION;	
   }	
@@ -478,7 +480,7 @@ HVC_RetCode HiveClient_JNI::getHiveTableInfo(const char* schName,
                                             const char* tabName,
                                             NABoolean readPartnInfo)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Enter HiveClient_JNI::getHiveTableInfo(%s, %s)", schName, tabName);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Enter HiveClient_JNI::getHiveTableInfo(%s, %s)", schName, tabName);
   if (initJNIEnv() != JOI_OK)
      return HVC_ERROR_INIT_PARAM;
   jstring js_schName = jenv_->NewStringUTF(schName);
@@ -508,7 +510,7 @@ HVC_RetCode HiveClient_JNI::getHiveTableInfo(const char* schName,
     jenv_->PopLocalFrame(NULL);
     return HVC_ERROR_GET_HVT_INFO_EXCEPTION;
   }
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "Exit HiveClient_JNI::getHiveTableInfo(%s, %s).", schName, tabName);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, "Exit HiveClient_JNI::getHiveTableInfo(%s, %s).", schName, tabName);
   jenv_->PopLocalFrame(NULL);
   if (jresult)
      return HVC_OK;
@@ -1171,5 +1173,5 @@ HVC_RetCode HiveClient_JNI::populateTableParams(NAHeap *heap, hive_sd_desc *sd,
 ////////////////////////////////////////////////////////////////////////////  
 void HiveClient_JNI::logIt(const char* str)
 {
-  QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, str);
+  QRLogger::log(CAT_SQL_HDFS, LL_DEBUG, str);
 }

http://git-wip-us.apache.org/repos/asf/trafodion/blob/7633327b/core/sql/sqlcomp/CmpDescribe.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp
index 4660b8e..ad10f5f 100644
--- a/core/sql/sqlcomp/CmpDescribe.cpp
+++ b/core/sql/sqlcomp/CmpDescribe.cpp
@@ -2359,12 +2359,11 @@ short CmpDescribeHiveTable (
 
   outputShortLine(space, "  )");
 
-  // show hive table partitions and buckets defination.
-  // this default schema name is what the Hive default schema is called in SeaHive
+  // show hive table partitions and buckets definition.
+  // this default database of hive which is mapped as schema HIVE in Trafodion
   HiveMetaData* md = bindWA.getSchemaDB()->getNATableDB()->getHiveMetaDB();
   NAString defSchema = ActiveSchemaDB()->getDefaults().getValue(HIVE_DEFAULT_SCHEMA);
   defSchema.toUpper();
-  struct hive_tbl_desc* htbl;
   NAString tableNameInt = dtName.getQualifiedNameObj().getObjectName();
   NAString schemaNameInt = dtName.getQualifiedNameObj().getSchemaName();
   if (dtName.getQualifiedNameObj().getUnqualifiedSchemaNameAsAnsiString() == defSchema)

http://git-wip-us.apache.org/repos/asf/trafodion/blob/7633327b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
----------------------------------------------------------------------
diff --git a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
index 5423efe..67a4142 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HiveClient.java
@@ -134,7 +134,6 @@ public class HiveClient {
 
     public static boolean close() 
     {	
-        hmsClient.close();	
         return true;	
     }