You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2017/10/03 15:15:31 UTC

[2/3] incubator-trafodion git commit: [mantis-4973] add fix for hive table and table under seabase.

[mantis-4973] add fix for hive table and table under seabase.


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

Branch: refs/heads/master
Commit: e0e8890f08ec0fa6ed659b1b8461a4170cd00aed
Parents: 9474cc4
Author: Andy Yang <yo...@esgyn.cn>
Authored: Fri Sep 29 17:31:37 2017 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Fri Sep 29 17:31:37 2017 +0800

----------------------------------------------------------------------
 core/sql/ustat/hs_globals.cpp | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0e8890f/core/sql/ustat/hs_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index 6b70666..fbaf1d3 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -8473,11 +8473,19 @@ Lng32 HSGlobalsClass::groupListFromTable(HSColGroupStruct*& groupList,
     // Initialize the pointer to the group list we will build.
     groupList = NULL;
     
-    // if showstats for a native hbase table, need to check if the schema _HBASESTATS_ exist
+    // if showstats for a native hbase table,hive table or table under seabase schema, 
+    // need to check if the table SB_HISTOGRAMS exist
+    NAString schemaName;
     if (strcmp(hstogram_table->data(), "TRAFODION.\"_HBASESTATS_\".SB_HISTOGRAMS") == 0)
+      schemaName = "_HBASESTATS_";
+    else if (strcmp(hstogram_table->data(), "TRAFODION.\"_HIVESTATS_\".SB_HISTOGRAMS") == 0)
+      schemaName = "_HIVESTATS_";
+    else if (strcmp(hstogram_table->data(), "TRAFODION.SEABASE.SB_HISTOGRAMS") == 0)
+      schemaName = "SEABASE";
+    if (!schemaName.isNull())
       {
-        NAString queryStr = "SELECT count(*) FROM \"_MD_\".OBJECTS WHERE SCHEMA_NAME='_HBASESTATS_' "
-                            "AND OBJECT_NAME='__SCHEMA__' AND OBJECT_TYPE='PS';";
+        NAString queryStr = "SELECT count(*) FROM \"_MD_\".OBJECTS WHERE SCHEMA_NAME='" + schemaName + 
+                            "' AND OBJECT_NAME='SB_HISTOGRAMS' AND OBJECT_TYPE='BT';";
         HSCursor cursor;
         retcode = cursor.prepareQuery(queryStr.data(), 0, 1);
         HSHandleError(retcode);
@@ -8487,7 +8495,10 @@ Lng32 HSGlobalsClass::groupListFromTable(HSColGroupStruct*& groupList,
         retcode = cursor.fetch (1, (void *)&cnt);
         HSHandleError(retcode);
         if (cnt == 0)
-          return 0;
+          {
+            LM->StopTimer();
+            return 0;
+          }
       }
 
 #ifdef NA_USTAT_USE_STATIC  // use static query defined in module file