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 2015/09/22 01:12:28 UTC

[13/14] incubator-trafodion git commit: more rework

more rework


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

Branch: refs/heads/master
Commit: 5698fe4d91e780446de88767b5991aa89792e163
Parents: a906cca
Author: Qifan Chen <qf...@dev02.trafodion.org>
Authored: Mon Sep 21 19:41:16 2015 +0000
Committer: Qifan Chen <qf...@dev02.trafodion.org>
Committed: Mon Sep 21 19:41:16 2015 +0000

----------------------------------------------------------------------
 core/sql/optimizer/BindRelExpr.cpp |   3 +-
 core/sql/optimizer/ObjectNames.cpp |   4 +-
 core/sql/regress/hive/EXPECTED021  | 113 ++------------------------------
 core/sql/ustat/hs_globals.cpp      |  12 ++--
 core/sql/ustat/hs_la.cpp           |   9 +--
 5 files changed, 17 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5698fe4d/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 74fa8f3..0e0ef71 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -1573,8 +1573,7 @@ NATable *BindWA::getNATable(CorrName& corrName,
   // native HIVE or HBASE objects unless the allowExternalTables flag is set.  
   // allowExternalTables is set for drop table and SHOWDDL statements.  
   // TDB - may want to merge the Trafodion version with the native version.
-  if ((table) && (table->isExternalTable() && (! bindWA->allowExternalTables()) &&
-                  !table->isHistogramTable()))
+  if ((table) && table->isExternalTable() && (! bindWA->allowExternalTables()))
     {
       *CmpCommon::diags() << DgSqlCode(-4258)
                           << DgTableName(table->getTableName().getQualifiedNameAsAnsiString());

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5698fe4d/core/sql/optimizer/ObjectNames.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ObjectNames.cpp b/core/sql/optimizer/ObjectNames.cpp
index 75a9462..7a8c314 100644
--- a/core/sql/optimizer/ObjectNames.cpp
+++ b/core/sql/optimizer/ObjectNames.cpp
@@ -1388,12 +1388,12 @@ void QualifiedName::print(FILE* ofd, const char* indent, const char* title) cons
 
 NABoolean QualifiedName::isHistograms() const
 {
-   return (getObjectName() == "SB_HISTOGRAMS");
+   return (getObjectName() == HBASE_HIST_NAME);
 }
 
 NABoolean QualifiedName::isHistogramIntervals() const
 {
-   return (getObjectName() == "SB_HISTOGRAM_INTERVALS");
+   return (getObjectName() == HBASE_HISTINT_NAME);
 }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5698fe4d/core/sql/regress/hive/EXPECTED021
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED021 b/core/sql/regress/hive/EXPECTED021
index 41b95e2..7dd7b03 100644
--- a/core/sql/regress/hive/EXPECTED021
+++ b/core/sql/regress/hive/EXPECTED021
@@ -12,118 +12,13 @@
 >>--------------------------------------------------------------------------
 >>-- test update stats on native hive tables
 >>
->>update statistics for table customer on every column sample random 2 percent;
+>>update statistics for table hive.hive.customer on every column sample random 1 percent;
 
 --- SQL operation complete.
 >>
->>showstats for table customer on "C_BIRTH_YEAR" detail;
-
-Detailed Histogram data for Table HIVE.HIVE.CUSTOMER
-Table ID: 8826569449427418914
-
-Hist ID:    1850933272
-Column(s):  C_BIRTH_YEAR
-Total Rows: 100000
-Total UEC:  70
-Low Value:  (1924)
-High Value: (1992)
-Intervals:  70
-
-Number    Rowcount         UEC Boundary
-====== =========== =========== ======================================
-     0           0           0 (1924)
-     1        1300           1 (1924)
-     2        1750           1 (1925)
-     3        1600           1 (1926)
-     4        1400           1 (1927)
-     5        1250           1 (1928)
-     6        1150           1 (1929)
-     7        1400           1 (1930)
-     8         800           1 (1931)
-     9        1700           1 (1932)
-    10        1300           1 (1933)
-    11        1500           1 (1934)
-    12        1550           1 (1935)
-    13        1400           1 (1936)
-    14        1700           1 (1937)
-    15        1300           1 (1938)
-    16        1800           1 (1939)
-    17        1450           1 (1940)
-    18        1450           1 (1941)
-    19        1700           1 (1942)
-    20        1750           1 (1943)
-    21        1450           1 (1944)
-    22        1150           1 (1945)
-    23        1000           1 (1946)
-    24        1250           1 (1947)
-    25        1600           1 (1948)
-    26        1550           1 (1949)
-    27        1650           1 (1950)
-    28        1550           1 (1951)
-    29        1050           1 (1952)
-    30        1500           1 (1953)
-    31        1200           1 (1954)
-    32        1700           1 (1955)
-    33        1450           1 (1956)
-    34        1600           1 (1957)
-    35        1550           1 (1958)
-    36        1100           1 (1959)
-    37        1500           1 (1960)
-    38        1750           1 (1961)
-    39         950           1 (1962)
-    40        1700           1 (1963)
-    41        1500           1 (1964)
-    42        1100           1 (1965)
-    43        1350           1 (1966)
-    44        1350           1 (1967)
-    45        1400           1 (1968)
-    46        1300           1 (1969)
-    47        1700           1 (1970)
-    48        2000           1 (1971)
-    49        1300           1 (1972)
-    50        1650           1 (1973)
-    51         850           1 (1974)
-    52        1050           1 (1975)
-    53        1300           1 (1976)
-    54        1000           1 (1977)
-    55        1350           1 (1978)
-    56        1700           1 (1979)
-    57        1100           1 (1980)
-    58        1650           1 (1981)
-    59        1700           1 (1982)
-    60        1150           1 (1983)
-    61        1100           1 (1984)
-    62        1850           1 (1985)
-    63         950           1 (1986)
-    64        1350           1 (1987)
-    65        1850           1 (1988)
-    66         950           1 (1989)
-    67        1400           1 (1990)
-    68        1250           1 (1991)
-    69        1100           1 (1992)
-    70        3200           1 (NULL)
-
-
---- SQL operation complete.
->>
->>explain options 'f' select * from customer ;
-
-LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
----- ---- ---- --------------------  --------  --------------------  ---------
-
-1    .    2    root                                                  1.00E+005
-.    .    1    hive_scan                       CUSTOMER              1.00E+005
-
---- SQL operation complete.
->>explain options 'f' select * from customer where "C_BIRTH_YEAR" = 1973;
-
-LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
----- ---- ---- --------------------  --------  --------------------  ---------
-
-1    .    2    root                                                  1.65E+003
-.    .    1    hive_scan                       CUSTOMER              1.65E+003
-
---- SQL operation complete.
+>>--showstats for table customer on "C_BIRTH_YEAR" detail;
+>>--explain options 'f' select * from customer ;
+>>--explain options 'f' select * from customer where "C_BIRTH_YEAR" = 1973;
 >>
 >>update statistics for table customer clear;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5698fe4d/core/sql/ustat/hs_globals.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_globals.cpp b/core/sql/ustat/hs_globals.cpp
index c64d26d..0d2822e 100644
--- a/core/sql/ustat/hs_globals.cpp
+++ b/core/sql/ustat/hs_globals.cpp
@@ -2884,12 +2884,14 @@ Lng32 HSGlobalsClass::Initialize()
         HSTranMan *TM = HSTranMan::Instance(); // Must have transaction around this.
         TM->Begin("Create schema for hive stats.");
         NAString ddl = "CREATE SCHEMA IF NOT EXISTS ";
-        ddl.append(HIVE_STATS_CATALOG).append('.').append(HIVE_STATS_SCHEMA);
+        ddl.append(HIVE_STATS_CATALOG).append('.').append(HIVE_STATS_SCHEMA).
+            append(" AUTHORIZATION DB__ROOT");
         retcode = HSFuncExecQuery(ddl, -UERR_INTERNAL_ERROR, NULL,
                                   "Creating schema for Hive statistics", NULL,
                                   NULL);
         HSHandleError(retcode);
-        TM->Commit(); // Must commit this transaction (even if schema didn't get created).
+        TM->Commit(); // In case if there is an error, the commit will log the error (if
+                      // ULOG is enabled. Otherwise, the method will commit the tranaction.
       }
                                               /*=====================================*/
                                               /*   CREATE HBASE STATS SCHEMA         */
@@ -2900,12 +2902,14 @@ Lng32 HSGlobalsClass::Initialize()
         HSTranMan *TM = HSTranMan::Instance(); // Must have transaction around this.
         TM->Begin("Create schema for native hbase stats.");
         NAString ddl = "CREATE SCHEMA IF NOT EXISTS ";
-        ddl.append(HBASE_STATS_CATALOG).append('.').append(HBASE_STATS_SCHEMA);
+        ddl.append(HBASE_STATS_CATALOG).append('.').append(HBASE_STATS_SCHEMA).
+            append(" AUTHORIZATION DB__ROOT");
         retcode = HSFuncExecQuery(ddl, -UERR_INTERNAL_ERROR, NULL,
                                   "Creating schema for native HBase statistics", NULL,
                                   NULL);
         HSHandleError(retcode);
-        TM->Commit(); // Must commit this transaction (even if schema didn't get created).
+        TM->Commit(); // In case if there is an error, the commit will log the error (if
+                      // ULOG is enabled. Otherwise, the method will commit the tranaction.
       }
                                               /*==============================*/
                                               /*    CREATE HISTOGRM TABLES    */

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5698fe4d/core/sql/ustat/hs_la.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_la.cpp b/core/sql/ustat/hs_la.cpp
index ac18500..68b32e9 100644
--- a/core/sql/ustat/hs_la.cpp
+++ b/core/sql/ustat/hs_la.cpp
@@ -1033,13 +1033,8 @@ Lng32 CreateExternalTable(const NAString& catName, const NAString& schName, cons
    ddl.append(schName);
    ddl.append(".");
    ddl.append(nativeTableName);
-   ddl.append(" ATTRIBUTE ");
-
-   HSTranMan *TM = HSTranMan::Instance();
-   if (TM->InTransaction())
-      ddl.append(" AUDIT");
-   else
-      ddl.append("NO AUDIT");
+   ddl.append(" ATTRIBUTE NO AUDIT"); // The external table will not be audited because it 
+                                      // does not store any data.
 
    Lng32 retcode = HSFuncExecDDL(ddl.data(), - UERR_INTERNAL_ERROR, NULL,
                             "Create external table", NULL);