You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by an...@apache.org on 2017/05/26 00:31:35 UTC

[1/2] incubator-trafodion git commit: jira trafodion-2621, trafodion-2619 + others

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 3cf6bf522 -> 22b739ef5


jira trafodion-2621, trafodion-2619 + others

-- trafodion-2621: add support to create like native hive or hbase tables
-- trafodion-2619: support to_date format 'yyyy/mm/dd'
-- alter table drop column on a table with user indexes would sometime
   fail. That has been fixed.
-- get schemas in a session where default catalog is set to hive,
   now correctly returns hive schemas
-- update stats on hive tables succeeds
-- update stats on hive view returns error as this operation
   is not supported


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

Branch: refs/heads/master
Commit: b109e2cf5883f8e763af853ab6fad7ce7110d9e8
Parents: 514679f
Author: Anoop Sharma <an...@esgyn.com>
Authored: Wed May 24 23:20:11 2017 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Wed May 24 23:20:11 2017 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_datetime.cpp           |  45 +++++++-
 core/sql/exp/exp_datetime.h             |   3 +-
 core/sql/generator/GenRelExeUtil.cpp    |   3 +-
 core/sql/regress/hive/EXPECTED009       | 162 ++++++++++++++++++++++++---
 core/sql/regress/hive/EXPECTED021       |  12 ++
 core/sql/regress/hive/TEST009           |  26 ++++-
 core/sql/regress/hive/TEST021           |   6 +
 core/sql/regress/seabase/EXPECTED030    |  17 +++
 core/sql/regress/seabase/EXPECTED031    | 108 ++++++++++++++++--
 core/sql/regress/seabase/TEST030        |   3 +
 core/sql/regress/seabase/TEST031        |  11 ++
 core/sql/sqlcomp/CmpDescribe.cpp        |  36 ++++--
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp |   4 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp |  47 ++++++--
 core/sql/ustat/hs_cli.cpp               |  10 --
 core/sql/ustat/hs_la.cpp                |  15 +++
 16 files changed, 444 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index f90aa5b..4c90ef6 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -155,6 +155,7 @@ const ExpDatetime::DatetimeFormatInfo ExpDatetime::datetimeFormat[] =
     {ExpDatetime::DATETIME_FORMAT_TS8,       "DD-MON-YYYY HH:MI:SS",  20, 20},
     {ExpDatetime::DATETIME_FORMAT_TS9,       "MONTH DD, YYYY, HH:MI", 19, 25},
     {ExpDatetime::DATETIME_FORMAT_TS10,      "DD.MM.YYYY HH24.MI.SS", 19, 19},
+    {ExpDatetime::DATETIME_FORMAT_TS11,      "YYYY/MM/DD HH24:MI:SS", 19, 19},
  
     {ExpDatetime::DATETIME_FORMAT_NUM1,      "99:99:99:99",           11, 11},
     {ExpDatetime::DATETIME_FORMAT_NUM2,      "-99:99:99:99",          12, 12},
@@ -2940,6 +2941,43 @@ ExpDatetime::convAsciiToDate(char *srcData,
     };  
     break;
 
+  case DATETIME_FORMAT_TS11: // YYYY/MM/DD HH24:MI:SS
+    {
+      char sep = '/';
+
+      // the year
+      if (convSrcDataToDst(4, srcData, 2, dstData, &sep, heap, diagsArea))
+        return -1;
+
+      // the month
+      if (convSrcDataToDst(2, srcData, 1, &dstData[2], &sep, heap, diagsArea))
+        return -1;
+
+      // the day
+      if (convSrcDataToDst(2, srcData, 1, &dstData[3], " ", heap, diagsArea))
+        return -1;
+
+      // the hour
+      if (convSrcDataToDst(2, srcData, 1, &dstData[4], ":", heap, diagsArea))
+        return -1;
+
+      // the minute
+      if (convSrcDataToDst(2, srcData, 1, &dstData[5], ":", heap, diagsArea))
+        return -1;
+
+      // the second
+      if (convSrcDataToDst(2, srcData, 1, &dstData[6], NULL, heap, diagsArea))
+        return -1;
+
+      dstData[7]  = 0;
+      dstData[8]  = 0;
+      dstData[9]  = 0;
+      dstData[10] = 0;
+
+      timeData = &dstData[4];
+    };  
+    break;
+
   case DATETIME_FORMAT_TS8: // DD-MON-YYYY HH:MI:SS
     {
       // the day
@@ -3295,6 +3333,7 @@ ExpDatetime::convDatetimeToASCII(char *srcData,
   case DATETIME_FORMAT_TS1:
   case DATETIME_FORMAT_TS3:
   case DATETIME_FORMAT_TS5:
+  case DATETIME_FORMAT_TS11:
     if (year) {
       if (format == DATETIME_FORMAT_USA5)
 	convertToAscii(year, dstDataPtr, 2);
@@ -3306,7 +3345,8 @@ ExpDatetime::convDatetimeToASCII(char *srcData,
 	    (format == DATETIME_FORMAT_TS3))
 	  *dstDataPtr++ = '-';
 	else if ((format == DATETIME_FORMAT_USA3) ||
-		 (format == DATETIME_FORMAT_USA5))
+		 (format == DATETIME_FORMAT_USA5) ||
+                 (format == DATETIME_FORMAT_TS11))
 	  *dstDataPtr++ = '/';
       }
     }
@@ -3317,7 +3357,8 @@ ExpDatetime::convDatetimeToASCII(char *srcData,
 	    (format == DATETIME_FORMAT_TS3))
 	  *dstDataPtr++ = '-';
 	else if ((format == DATETIME_FORMAT_USA3) ||
-		 (format == DATETIME_FORMAT_USA5))
+		 (format == DATETIME_FORMAT_USA5) ||
+		 (format == DATETIME_FORMAT_TS11))
 	  *dstDataPtr++ = '/';
       }
     }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/exp/exp_datetime.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.h b/core/sql/exp/exp_datetime.h
index 57da0f2..fadda78 100644
--- a/core/sql/exp/exp_datetime.h
+++ b/core/sql/exp/exp_datetime.h
@@ -85,7 +85,8 @@ public:
     DATETIME_FORMAT_TS8,     // DD-MON-YYYY HH:MI:SS
     DATETIME_FORMAT_TS9,     // MONTH DD, YYYY, HH:MI AM|PM
     DATETIME_FORMAT_TS10,    // DD.MM.YYYY HH24:MI:SS
-    DATETIME_FORMAT_MAX_TS    = DATETIME_FORMAT_TS10,
+    DATETIME_FORMAT_TS11,    // YYYY/MM/DD HH24:MI:SS
+    DATETIME_FORMAT_MAX_TS    = DATETIME_FORMAT_TS11,
 
     DATETIME_FORMAT_MAX       = DATETIME_FORMAT_MAX_TS,
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/generator/GenRelExeUtil.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelExeUtil.cpp b/core/sql/generator/GenRelExeUtil.cpp
index 71788e3..1a5dda3 100644
--- a/core/sql/generator/GenRelExeUtil.cpp
+++ b/core/sql/generator/GenRelExeUtil.cpp
@@ -1911,7 +1911,8 @@ short ExeUtilGetMetadataInfo::codeGen(Generator * generator)
        getCatalogName() == HIVE_SYSTEM_CATALOG) &&
       ((queryType == ComTdbExeUtilGetMetadataInfo::TABLES_IN_SCHEMA_) ||
        (queryType == ComTdbExeUtilGetMetadataInfo::OBJECTS_IN_SCHEMA_) ||
-       (queryType == ComTdbExeUtilGetMetadataInfo::VIEWS_IN_SCHEMA_)))
+       (queryType == ComTdbExeUtilGetMetadataInfo::VIEWS_IN_SCHEMA_) ||
+       (queryType == ComTdbExeUtilGetMetadataInfo::SCHEMAS_IN_CATALOG_)))
     {
       catName = 
         generator->currentCmpContext()->schemaDB_->getDefaultSchema().

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/hive/EXPECTED009
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED009 b/core/sql/regress/hive/EXPECTED009
index 6d97be0..45b027e 100644
--- a/core/sql/regress/hive/EXPECTED009
+++ b/core/sql/regress/hive/EXPECTED009
@@ -207,17 +207,98 @@ A            B            C
 
 --- SQL operation complete.
 >>
->>-- these creates fail
->>create table hive_customer like hive.hive.customer;
+>>-- create like on hive tables/views
+>>create table t009hivecust1 like hive.hive.customer;
 
-*** ERROR[1010] The statement just entered is currently not supported.
+--- SQL operation complete.
+>>invoke t009hivecust1;
 
---- SQL operation failed with errors.
+-- Definition of Trafodion table TRAFODION.HIVE_T009.T009HIVECUST1
+-- Definition current  Tue May 16 15:38:03 2017
+
+  (
+    SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
+  , C_CUSTOMER_SK                    INT DEFAULT NULL
+  , C_CUSTOMER_ID                    VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_CURRENT_CDEMO_SK               INT DEFAULT NULL
+  , C_CURRENT_HDEMO_SK               INT DEFAULT NULL
+  , C_CURRENT_ADDR_SK                INT DEFAULT NULL
+  , C_FIRST_SHIPTO_DATE_SK           INT DEFAULT NULL
+  , C_FIRST_SALES_DATE_SK            INT DEFAULT NULL
+  , C_SALUTATION                     VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_FIRST_NAME                     VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LAST_NAME                      VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_PREFERRED_CUST_FLAG            VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_BIRTH_DAY                      INT DEFAULT NULL
+  , C_BIRTH_MONTH                    INT DEFAULT NULL
+  , C_BIRTH_YEAR                     INT DEFAULT NULL
+  , C_BIRTH_COUNTRY                  VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LOGIN                          VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_EMAIL_ADDRESS                  VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LAST_REVIEW_DATE               VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  )
+
+--- SQL operation complete.
 >>create table newtable1 like hive.hive.customer;
 
-*** ERROR[1010] The statement just entered is currently not supported.
+--- SQL operation complete.
+>>process hive statement 'drop view t009cust';
+
+--- SQL operation complete.
+>>process hive statement 'create view t009cust as select * from customer';
 
---- SQL operation failed with errors.
+--- SQL operation complete.
+>>create table t009hivecust2 like hive.hive.t009cust;
+
+--- SQL operation complete.
+>>invoke t009hivecust2;
+
+-- Definition of Trafodion table TRAFODION.HIVE_T009.T009HIVECUST2
+-- Definition current  Tue May 16 15:38:13 2017
+
+  (
+    SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
+  , C_CUSTOMER_SK                    INT DEFAULT NULL
+  , C_CUSTOMER_ID                    VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_CURRENT_CDEMO_SK               INT DEFAULT NULL
+  , C_CURRENT_HDEMO_SK               INT DEFAULT NULL
+  , C_CURRENT_ADDR_SK                INT DEFAULT NULL
+  , C_FIRST_SHIPTO_DATE_SK           INT DEFAULT NULL
+  , C_FIRST_SALES_DATE_SK            INT DEFAULT NULL
+  , C_SALUTATION                     VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_FIRST_NAME                     VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LAST_NAME                      VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_PREFERRED_CUST_FLAG            VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_BIRTH_DAY                      INT DEFAULT NULL
+  , C_BIRTH_MONTH                    INT DEFAULT NULL
+  , C_BIRTH_YEAR                     INT DEFAULT NULL
+  , C_BIRTH_COUNTRY                  VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LOGIN                          VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_EMAIL_ADDRESS                  VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  , C_LAST_REVIEW_DATE               VARCHAR(20 BYTES) CHARACTER SET UTF8
+      COLLATE DEFAULT DEFAULT NULL
+  )
+
+--- SQL operation complete.
+>>
+>>-- these creates fail
 >>create external table seabase.customer like hive.hive.customer;
 
 *** ERROR[3242] This statement is not supported. Reason: 'like' clause cannot be specified when creating an external table.
@@ -313,11 +394,13 @@ CATALOG_NAME
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                CUSTOMER                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              SCH_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         HIVE_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                T009HIVECUST1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
+TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         HIVE_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                T009HIVECUST2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_HIVE_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_SCH_T009_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                OBJECTS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
 
---- 6 row(s) selected.
+--- 8 row(s) selected.
 >>drop external table t009t1 for hive.sch_t009.t009t1;
 
 --- SQL operation complete.
@@ -329,11 +412,13 @@ CATALOG_NAME
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                CUSTOMER                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 HIVE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              SCH_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
+TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         HIVE_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                T009HIVECUST1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
+TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         HIVE_T009                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                T009HIVECUST2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_HIVE_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_SCH_T009_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                OBJECTS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
 
---- 6 row(s) selected.
+--- 8 row(s) selected.
 >>create external table t009t1 for hive.sch_t009.t009t1;
 
 --- SQL operation complete.
@@ -349,7 +434,7 @@ T009T2
 >>invoke hive.sch_t009.t009t1;
 
 -- Definition of hive table T009T1
--- Definition current  Mon May  1 18:17:29 2017
+-- Definition current  Tue May 16 15:39:45 2017
 
   (
     A                                INT
@@ -424,6 +509,47 @@ ROW_ID      COLS
 
 --- 3 row(s) selected.
 >>
+>>-- create like on native hbase tables
+>>create table bblike1 like hbase."_ROW_"."baseball";
+
+--- SQL operation complete.
+>>invoke bblike1;
+
+-- Definition of Trafodion table TRAFODION.HIVE_T009.BBLIKE1
+-- Definition current  Tue May 16 15:39:59 2017
+
+  (
+    ROW_ID                           VARCHAR(100) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  , COLUMN_DETAILS                   VARCHAR(10000) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  )
+  PRIMARY KEY (ROW_ID ASC)
+
+--- SQL operation complete.
+>>create table bblike2 like hbase."_CELL_"."baseball";
+
+--- SQL operation complete.
+>>invoke bblike2;
+
+-- Definition of Trafodion table TRAFODION.HIVE_T009.BBLIKE2
+-- Definition current  Tue May 16 15:40:04 2017
+
+  (
+    ROW_ID                           VARCHAR(100) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  , COL_FAMILY                       VARCHAR(100) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  , COL_NAME                         VARCHAR(100) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  , COL_TIMESTAMP                    LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
+  , COL_VALUE                        VARCHAR(1000) CHARACTER SET ISO88591
+      COLLATE DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  )
+  PRIMARY KEY (ROW_ID ASC)
+
+--- SQL operation complete.
+>>
 >>-- error. Cannot create a non-hbase-mapped table
 >>create external table "baseball" for hbase."_ROW_"."baseball";
 
@@ -446,7 +572,7 @@ ROW_ID      COLS
 >>invoke hive.hive.store_sales;
 
 -- Definition of hive table STORE_SALES
--- Definition current  Mon May  1 18:18:05 2017
+-- Definition current  Tue May 16 15:40:10 2017
 
   (
     SS_SOLD_DATE_SK                  INT
@@ -490,7 +616,7 @@ ROW_ID      COLS
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212360422685553602
+PLAN_ID .................. 212361709210663826
 ROWS_OUT ............. 1,709
 EST_TOTAL_COST ........... 0.27
 STATEMENT ................ select * from store_sales where ss_item_sk = 1;
@@ -619,7 +745,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212360422686017142
+PLAN_ID .................. 212361709210888079
 ROWS_OUT ......... 2,920,643
 EST_TOTAL_COST ........... 1.07
 STATEMENT ................ select *
@@ -821,7 +947,7 @@ DESCRIPTION
 >>invoke hive.hive.date_dim;
 
 -- Definition of hive table DATE_DIM
--- Definition current  Mon May  1 18:18:15 2017
+-- Definition current  Tue May 16 15:40:16 2017
 
   (
     D_DATE_SK                        INT
@@ -905,7 +1031,7 @@ CREATE TABLE DATE_DIM
 ;
 
 REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.DATE_DIM;
-/* ObjectUID = 9189160505820275449 */
+/* ObjectUID = 24899351381469208 */
 
 /* Trafodion DDL */
 
@@ -965,7 +1091,7 @@ CREATE EXTERNAL TABLE DATE_DIM
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212360422699701203
+PLAN_ID .................. 212361709220931595
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select *
@@ -1056,7 +1182,7 @@ DESCRIPTION
 >>invoke hive.hive.date_dim;
 
 -- Definition of hive table DATE_DIM
--- Definition current  Mon May  1 18:18:30 2017
+-- Definition current  Tue May 16 15:40:28 2017
 
   (
     D_DATE_SK                        INT
@@ -1140,7 +1266,7 @@ CREATE TABLE DATE_DIM
 ;
 
 REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.DATE_DIM;
-/* ObjectUID = 9189160505820275449 */
+/* ObjectUID = 24899351381469208 */
 
 /* Trafodion DDL */
 
@@ -1200,7 +1326,7 @@ CREATE EXTERNAL TABLE DATE_DIM
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212360422714471702
+PLAN_ID .................. 212361709232113312
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select *

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/hive/EXPECTED021
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED021 b/core/sql/regress/hive/EXPECTED021
index 7dd7b03..8cd52d8 100644
--- a/core/sql/regress/hive/EXPECTED021
+++ b/core/sql/regress/hive/EXPECTED021
@@ -24,4 +24,16 @@
 
 --- SQL operation complete.
 >>
+>>-- force sample table creation
+>>cqd ustat_internal_sort 'OFF';
+
+--- SQL operation complete.
+>>cqd ustat_force_temp 'ON';
+
+--- SQL operation complete.
+>>update statistics for table hive.hive.store_sales on every column 
++>sample random 10 percent;
+
+--- SQL operation complete.
+>>
 >>log;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/hive/TEST009
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST009 b/core/sql/regress/hive/TEST009
index e9f1a22..23bd036 100755
--- a/core/sql/regress/hive/TEST009
+++ b/core/sql/regress/hive/TEST009
@@ -81,7 +81,14 @@ reset parserflags 131072;
 
 --cqd hive_use_ext_table_attrs 'ON';
 cqd hive_max_string_length_in_bytes '20';
- 
+
+drop table bblike1;
+drop table bblike2;
+drop table t009hivecust1;
+drop table t009hivecust2;
+
+process hive statement 'drop view t009cust';
+
 ?section create_db
 
 -- The version of hive installed does not support special characters
@@ -148,9 +155,16 @@ create table newtable3 (a int);
 create schema hive_t009;
 set schema hive_t009;
 
--- these creates fail
-create table hive_customer like hive.hive.customer;
+-- create like on hive tables/views
+create table t009hivecust1 like hive.hive.customer;
+invoke t009hivecust1;
 create table newtable1 like hive.hive.customer;
+process hive statement 'drop view t009cust';
+process hive statement 'create view t009cust as select * from customer';
+create table t009hivecust2 like hive.hive.t009cust;
+invoke t009hivecust2;
+
+-- these creates fail
 create external table seabase.customer like hive.hive.customer;
 create external table customer1 like hive.hive.customer;
 create table t009t2 as select * from "_HV_SCH_T009_".t009t2;
@@ -201,6 +215,12 @@ select count(*) from hbase."_CELL_"."baseball";
 
 select left(row_id, 10) as row_id, left(column_display(column_details, ('teams:team_number', 'games:visitor_team', 'games:game_time')), 100) as cols from hbase."_ROW_"."baseball";
 
+-- create like on native hbase tables
+create table bblike1 like hbase."_ROW_"."baseball";
+invoke bblike1;
+create table bblike2 like hbase."_CELL_"."baseball";
+invoke bblike2;
+
 -- error. Cannot create a non-hbase-mapped table
 create external table "baseball" for hbase."_ROW_"."baseball";
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/hive/TEST021
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST021 b/core/sql/regress/hive/TEST021
index b7c7e14..d81a77b 100644
--- a/core/sql/regress/hive/TEST021
+++ b/core/sql/regress/hive/TEST021
@@ -46,3 +46,9 @@ update statistics for table hive.hive.customer on every column sample random 1 p
 
 update statistics for table customer clear;
 
+-- force sample table creation
+cqd ustat_internal_sort 'OFF';
+cqd ustat_force_temp 'ON';
+update statistics for table hive.hive.store_sales on every column 
+sample random 10 percent;
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/seabase/EXPECTED030
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED030 b/core/sql/regress/seabase/EXPECTED030
index 9283713..59e7880 100644
--- a/core/sql/regress/seabase/EXPECTED030
+++ b/core/sql/regress/seabase/EXPECTED030
@@ -152,6 +152,23 @@
 
 --- 1 row(s) selected.
 >>
+>>select to_date('2017/05/15 10:11:12', 'yyyy/mm/dd hh24:mi:ss') from dual;
+
+(EXPR)                    
+--------------------------
+
+2017-05-15 10:11:12.000000
+
+--- 1 row(s) selected.
+>>select to_char(timestamp '2017-05-15 10:11:12', 'yyyy/mm/dd hh24:mi:ss') from dual;
+
+(EXPR)             
+-------------------
+
+2017/05/15 10:11:12
+
+--- 1 row(s) selected.
+>>
 >>select to_time ('10:23:34', 'HH24:MI:SS') from (values(1)) x(a);
 
 (EXPR)  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/seabase/EXPECTED031
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED031 b/core/sql/regress/seabase/EXPECTED031
index b132c19..818106f 100644
--- a/core/sql/regress/seabase/EXPECTED031
+++ b/core/sql/regress/seabase/EXPECTED031
@@ -446,7 +446,7 @@ Z            Z            (EXPR)  (EXPR)
 >>invoke t031t10;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T10
--- Definition current  Wed May  3 15:06:43 2017
+-- Definition current  Tue May 23 23:30:09 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -648,7 +648,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:07:47 2017
+-- Definition current  Tue May 23 23:31:07 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -679,7 +679,7 @@ A            B
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:07:53 2017
+-- Definition current  Tue May 23 23:31:13 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -730,7 +730,7 @@ A            B                     C
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:07:58 2017
+-- Definition current  Tue May 23 23:31:23 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -759,7 +759,7 @@ A            B                     C
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:08:09 2017
+-- Definition current  Tue May 23 23:31:32 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -784,7 +784,7 @@ A            B                     C
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:08:13 2017
+-- Definition current  Tue May 23 23:31:36 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -804,7 +804,7 @@ A            B                     C
 >>invoke t031t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1
--- Definition current  Wed May  3 15:08:16 2017
+-- Definition current  Tue May 23 23:31:40 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -819,7 +819,7 @@ A            B                     C
 >>invoke t031v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T031V1
--- Definition current  Wed May  3 15:08:19 2017
+-- Definition current  Tue May 23 23:31:43 2017
 
   (
     A                                INT DEFAULT NULL
@@ -842,7 +842,7 @@ A            B                     C
 >>invoke t031v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T031V1
--- Definition current  Wed May  3 15:08:23 2017
+-- Definition current  Tue May 23 23:31:50 2017
 
   (
     A                                INT DEFAULT NULL
@@ -860,7 +860,7 @@ A            B                     C
 >>invoke t031v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T031V1
--- Definition current  Wed May  3 15:08:31 2017
+-- Definition current  Tue May 23 23:31:59 2017
 
   (
     A                                INT DEFAULT NULL
@@ -947,7 +947,7 @@ CREATE INDEX T031T1I1 ON TRAFODION.SCH.T031T1
 >>invoke table(index_table t031t1i1);
 
 -- Definition of Trafodion table TRAFODION.SCH.T031T1I1
--- Definition current  Wed May  3 15:08:49 2017
+-- Definition current  Tue May 23 23:32:19 2017
 
   (
     "A@"                             INT NO DEFAULT
@@ -1090,7 +1090,7 @@ CREATE TABLE T031HIVET1
 ;
 
 REGISTER /*INTERNAL*/ HIVE TABLE HIVE.HIVE.T031HIVET1;
-/* ObjectUID = 4568467281340475481 */
+/* ObjectUID = 6847852784245519545 */
 
 /* Trafodion DDL */
 
@@ -1180,4 +1180,88 @@ abcde
 
 --- 1 row(s) selected.
 >>
+>>-- drop column on table with indexes
+>>drop table if exists t031t1 cascade;
+
+--- SQL operation complete.
+>>create table t031t1 (a int, b int, constraint t031const1  unique (a));
+
+--- SQL operation complete.
+>>insert into t031t1 values (1,1), (2,2);
+
+--- 2 row(s) inserted.
+>>showddl t031t1;
+
+CREATE TABLE TRAFODION.SCH.T031T1
+  (
+    A                                INT DEFAULT NULL
+  , B                                INT DEFAULT NULL
+  )
+ ATTRIBUTES ALIGNED FORMAT
+;
+
+-- The following index is a system created index --
+CREATE UNIQUE INDEX T031CONST1 ON TRAFODION.SCH.T031T1
+  (
+    A ASC
+  )
+;
+
+ALTER TABLE TRAFODION.SCH.T031T1 ADD CONSTRAINT TRAFODION.SCH.T031CONST1
+  UNIQUE
+  (
+    A
+  )
+;
+
+--- SQL operation complete.
+>>alter table t031t1 drop column b;
+
+--- SQL operation complete.
+>>showddl t031t1;
+
+CREATE TABLE TRAFODION.SCH.T031T1
+  (
+    A                                INT DEFAULT NULL
+  )
+ ATTRIBUTES ALIGNED FORMAT
+;
+
+-- The following index is a system created index --
+CREATE UNIQUE INDEX T031CONST1 ON TRAFODION.SCH.T031T1
+  (
+    A ASC
+  )
+;
+
+ALTER TABLE TRAFODION.SCH.T031T1 ADD CONSTRAINT TRAFODION.SCH.T031CONST1
+  UNIQUE
+  (
+    A
+  )
+;
+
+--- SQL operation complete.
+>>select * from t031t1;
+
+A          
+-----------
+
+          1
+          2
+
+--- 2 row(s) selected.
+>>set parserflags 1;
+
+--- SQL operation complete.
+>>select * from table(index_table t031const1);
+
+A@           SYSKEY              
+-----------  --------------------
+
+          1   2968565314541304116
+          2   2968565314541629166
+
+--- 2 row(s) selected.
+>>
 >>log;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/seabase/TEST030
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST030 b/core/sql/regress/seabase/TEST030
index 16d5593..ed43ff9 100644
--- a/core/sql/regress/seabase/TEST030
+++ b/core/sql/regress/seabase/TEST030
@@ -44,6 +44,9 @@ select to_date('03/01/2016 10:11:12', 'MM/DD/YYYY HH24:MI:SS') from (values(1))
 select to_date('01-MAR-2016 10:11:12', 'DD-MON-YYYY HH:MI:SS') from (values(1)) x(a);
 select to_date('March 01, 2016, 10:11', 'MONTH DD, YYYY, HH:MI') from (values(1)) x(a);
 
+select to_date('2017/05/15 10:11:12', 'yyyy/mm/dd hh24:mi:ss') from dual;
+select to_char(timestamp '2017-05-15 10:11:12', 'yyyy/mm/dd hh24:mi:ss') from dual;
+
 select to_time ('10:23:34', 'HH24:MI:SS') from (values(1)) x(a);
 select to_time ('10:23:34', 'HH:MI:SS') from (values(1)) x(a);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/regress/seabase/TEST031
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST031 b/core/sql/regress/seabase/TEST031
index 219a673..3fcb8a9 100644
--- a/core/sql/regress/seabase/TEST031
+++ b/core/sql/regress/seabase/TEST031
@@ -344,4 +344,15 @@ create index t031t1i on t031t1(b);
 explain options 'f' select a from t031t1;
 select a from t031t1;
 
+-- drop column on table with indexes
+drop table if exists t031t1 cascade;
+create table t031t1 (a int, b int, constraint t031const1  unique (a));
+insert into t031t1 values (1,1), (2,2);
+showddl t031t1;
+alter table t031t1 drop column b;
+showddl t031t1;
+select * from t031t1;
+set parserflags 1;
+select * from table(index_table t031const1);
+
 log;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/sqlcomp/CmpDescribe.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDescribe.cpp b/core/sql/sqlcomp/CmpDescribe.cpp
index 5aa5ced..d3bd49a 100644
--- a/core/sql/sqlcomp/CmpDescribe.cpp
+++ b/core/sql/sqlcomp/CmpDescribe.cpp
@@ -188,7 +188,8 @@ short CmpDescribeHiveTable (
                              short type, // 1, invoke. 2, showddl. 3, createLike
                              char* &outbuf,
                              ULng32 &outbuflen,
-                             CollHeap *heap);
+                             CollHeap *heap,
+                             UInt32 columnLengthLimit = UINT_MAX);
 
 short CmpDescribeSeabaseTable ( 
      const CorrName  &dtName,
@@ -2206,7 +2207,8 @@ short CmpDescribeHiveTable (
                              short type, // 1, invoke. 2, showddl. 3, createLike
                              char* &outbuf,
                              ULng32 &outbuflen,
-                             CollHeap *heap)
+                             CollHeap *heap,
+                             UInt32 columnLengthLimit)
 {
   const NAString& tableName =
     dtName.getQualifiedNameObj().getObjectName();
@@ -2242,8 +2244,10 @@ short CmpDescribeHiveTable (
   if (NOT naTable->isHiveTable())
     return -1;
 
+#ifdef __ignore
   if (NOT ((type == 1) || (type == 2)))
     return -1;
+#endif
 
   char * buf = new (heap) char[15000];
   CMPASSERT(buf);
@@ -2340,11 +2344,29 @@ short CmpDescribeHiveTable (
               ANSI_ID(colName.data()));
       
       NAString nas;
-      if (type == 1)
+      if ((type == 1) || (type == 3))
         nat->getMyTypeAsText(&nas, FALSE);
       else
         nat->getMyTypeAsHiveText(&nas);
       
+      // if it is a character type and it is longer than the length
+      // limit in bytes, then shorten the target type
+      if ((type == 3) &&
+          (nat->getTypeQualifier() == NA_CHARACTER_TYPE) &&
+          (!nat->isLob()) &&
+          (columnLengthLimit < UINT_MAX))
+        {
+          const CharType * natc = (const CharType *)nat;
+          if (natc->getDataStorageSize() > columnLengthLimit)
+            {
+              CharType * newType = (CharType *)natc->newCopy(NULL);
+              newType->setDataStorageSize(columnLengthLimit);
+              nas.clear();
+              newType->getMyTypeAsText(&nas, FALSE);
+              delete newType;
+            }
+        }
+
       sprintf(&buf[strlen(buf)], "%s", nas.data());
 
       NAString colString(buf);
@@ -2363,21 +2385,21 @@ short CmpDescribeHiveTable (
         {
           if (type == 1)
             outputShortLine(space, "  /* stored as orc */");
-          else
+          else if (type == 2)
             outputShortLine(space, "  stored as orc ");
         }
       else if (hTabStats->isTextFile())
         {
           if (type == 1)
             outputShortLine(space, "  /* stored as textfile */");
-          else
+          else if (type == 2)
             outputShortLine(space, "  stored as textfile ");
         }
       else if (hTabStats->isSequenceFile())
         {
           if (type == 1)
             outputShortLine(space, "  /* stored as sequence */");
-          else
+          else if (type == 2)
             outputShortLine(space, "  stored as sequence ");
         }
     }
@@ -3427,7 +3449,7 @@ short CmpDescribeSeabaseTable (
       if (NOT noTrailingSemi)
         outputShortLine(*space, ";");
 
-      if (isHbaseCellOrRowTable)
+      if ((type == 2) && isHbaseCellOrRowTable)
         outputShortLine(*space, "*/");
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index d0cabd9..9ff73c8 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@ -897,13 +897,15 @@ void CmpSeabaseDDL::createSeabaseIndex( StmtDDLCreateIndex * createIndexNode,
   tableInfo->objOwnerID = naTable->getOwner(); 
   tableInfo->schemaOwnerID = naTable->getSchemaOwner();
 
+#ifdef __ignore
   if (NOT createIndexNode->isNoPopulateOptionSpecified())
     // if index is to be populated during create index, then initially create it as an
     // unaudited index. That would avoid any transactional inserts.
     // After the index has been populated, make it audited.
     tableInfo->isAudited = 0;
   else
-    tableInfo->isAudited = (nafs->isAudited() ? 1 : 0);
+#endif
+  tableInfo->isAudited = (nafs->isAudited() ? 1 : 0);
 
   tableInfo->validDef = 0;
   tableInfo->hbaseCreateOptions = NULL;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 18bea7f..7e50c99 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -81,6 +81,14 @@ extern short CmpDescribeSeabaseTable (
      const NAType * natype = NULL,
      Space *inSpace = NULL);
 
+short CmpDescribeHiveTable ( 
+                             const CorrName  &dtName,
+                             short type, // 1, invoke. 2, showddl. 3, createLike
+                             char* &outbuf,
+                             ULng32 &outbuflen,
+                             CollHeap *heap,
+                             UInt32 columnLengthLimit = UINT_MAX);
+
 // type:  1, invoke. 2, showddl. 3, create_like
 extern short cmpDisplayColumn(const NAColumn *nac,
                               char * inColName,
@@ -368,14 +376,18 @@ void CmpSeabaseDDL::createSeabaseTableLike(ExeCliInterface * cliInterface,
   
   char * buf = NULL;
   ULng32 buflen = 0;
-  retcode = CmpDescribeSeabaseTable(cn, 3/*createlike*/, buf, buflen, STMTHEAP,
-                                    NULL,
-                                    likeOptions.getIsWithHorizontalPartitions(),
-                                    likeOptions.getIsWithoutSalt(),
-                                    likeOptions.getIsWithoutDivision(),
-                                    likeOptions.getIsWithoutRowFormat(),
-                                    likeOptions.getIsLikeOptColumnLengthLimit(),
-                                    TRUE);
+  if (srcCatNamePart == HIVE_SYSTEM_CATALOG)
+    retcode = CmpDescribeHiveTable(cn, 3/*createlike*/, buf, buflen, STMTHEAP,
+                                   likeOptions.getIsLikeOptColumnLengthLimit());
+  else
+    retcode = CmpDescribeSeabaseTable(cn, 3/*createlike*/, buf, buflen, STMTHEAP,
+                                      NULL,
+                                      likeOptions.getIsWithHorizontalPartitions(),
+                                      likeOptions.getIsWithoutSalt(),
+                                      likeOptions.getIsWithoutDivision(),
+                                      likeOptions.getIsWithoutRowFormat(),
+                                      likeOptions.getIsLikeOptColumnLengthLimit(),
+                                      TRUE);
   if (retcode)
     return;
 
@@ -6004,7 +6016,7 @@ short CmpSeabaseDDL::alignedFormatTableDropColumn
       cliRC = -1;
       goto label_restore;
     }
-  
+
   ActiveSchemaDB()->getNATableDB()->removeNATable
     (cn,
      ComQiScope::REMOVE_FROM_ALL_USERS, 
@@ -6036,6 +6048,16 @@ short CmpSeabaseDDL::alignedFormatTableDropColumn
       goto label_restore;
     }
 
+  if (naTable->hasSecondaryIndexes()) // user indexes
+    {
+      cliRC = cliInterface.holdAndSetCQD("hide_indexes", "ALL");
+      if (cliRC < 0)
+        {
+          cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
+          goto label_restore;
+        }
+    }
+
   str_sprintf(buf, "upsert using load into %s(%s) select %s from %s",
               naTable->getTableName().getQualifiedNameAsAnsiString().data(),
               tgtCols.data(),
@@ -6051,6 +6073,9 @@ short CmpSeabaseDDL::alignedFormatTableDropColumn
   if (identityGenAlways)
     cliInterface.restoreCQD("override_generated_identity_values");
 
+  if (naTable->hasSecondaryIndexes()) // user indexes
+    cliInterface.restoreCQD("hide_indexes");
+
   if ((cliRC = recreateUsingViews(&cliInterface, viewNameList, viewDefnList,
                                   ddlXns)) < 0)
     {
@@ -6070,6 +6095,7 @@ short CmpSeabaseDDL::alignedFormatTableDropColumn
       cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
       goto label_restore;
     }
+
   
   deallocEHI(ehi); 
   
@@ -6081,6 +6107,9 @@ short CmpSeabaseDDL::alignedFormatTableDropColumn
   if (identityGenAlways)
     cliInterface.restoreCQD("override_generated_identity_values");
 
+  if (naTable->hasSecondaryIndexes()) // user indexes
+    cliInterface.restoreCQD("hide_indexes");
+
   ActiveSchemaDB()->getNATableDB()->removeNATable
     (cn,
      ComQiScope::REMOVE_FROM_ALL_USERS, 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp
index 046f415..cd9a571 100644
--- a/core/sql/ustat/hs_cli.cpp
+++ b/core/sql/ustat/hs_cli.cpp
@@ -607,19 +607,9 @@ Lng32 HSSample::create(NAString& tblName, NABoolean unpartitioned, NABoolean isP
 
     HSGlobalsClass *hs_globals = GetHSContext();
 
-    // If the table is a native one, convert the fully qualified user table name NT
-    // to a fully qualified external table name ET. The sample table will be created
-    // like ET.
     NABoolean isNativeTable =  
       HSGlobalsClass::isNativeCat(objDef->getCatName(HSTableDef::EXTERNAL_FORMAT));
 
-    if ( isNativeTable ) {
-      userTabName = ComConvertNativeNameToTrafName(
-                      objDef->getCatName(HSTableDef::EXTERNAL_FORMAT),
-                      objDef->getSchemaName(HSTableDef::EXTERNAL_FORMAT),
-                      objDef->getObjectName(HSTableDef::EXTERNAL_FORMAT));
-    }
-
     NAString userLocation;
     ComObjectName *sampleName;
     NAString tableOptions;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/b109e2cf/core/sql/ustat/hs_la.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_la.cpp b/core/sql/ustat/hs_la.cpp
index 0370f47..eb0a465 100644
--- a/core/sql/ustat/hs_la.cpp
+++ b/core/sql/ustat/hs_la.cpp
@@ -1169,6 +1169,21 @@ NABoolean HSTableDef::setObjectUID(NABoolean createExternalTable)
     NAString objName = getObjectName(EXTERNAL_FORMAT);
     Lng32 retcode = 0;
 
+    setNATable();
+    if (!naTbl_)
+      return FALSE;
+
+   if ((catName == HIVE_SYSTEM_CATALOG) &&
+        (naTbl_->isView()))
+      {
+        CmpCommon::diags()->clear();
+        *CmpCommon::diags()
+          << DgSqlCode(-UERR_INVALID_OBJECT)
+          << DgString0(naTbl_->getTableName().getQualifiedNameAsString());
+        
+        return FALSE;
+      }
+
     if (catName == HIVE_SYSTEM_CATALOG)
       retcode = RegisterHiveTable(catName, schName, objName);
     else


[2/2] incubator-trafodion git commit: PR-1102 jira trafodion-2621, trafodion-2619 + others

Posted by an...@apache.org.
PR-1102 jira trafodion-2621, trafodion-2619 + others 


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

Branch: refs/heads/master
Commit: 22b739ef53928256e058929a0963c2747cb879fe
Parents: 3cf6bf5 b109e2c
Author: Anoop Sharma <an...@esgyn.com>
Authored: Fri May 26 00:31:13 2017 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Fri May 26 00:31:13 2017 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_datetime.cpp           |  45 +++++++-
 core/sql/exp/exp_datetime.h             |   3 +-
 core/sql/generator/GenRelExeUtil.cpp    |   3 +-
 core/sql/regress/hive/EXPECTED009       | 162 ++++++++++++++++++++++++---
 core/sql/regress/hive/EXPECTED021       |  12 ++
 core/sql/regress/hive/TEST009           |  26 ++++-
 core/sql/regress/hive/TEST021           |   6 +
 core/sql/regress/seabase/EXPECTED030    |  17 +++
 core/sql/regress/seabase/EXPECTED031    | 108 ++++++++++++++++--
 core/sql/regress/seabase/TEST030        |   3 +
 core/sql/regress/seabase/TEST031        |  11 ++
 core/sql/sqlcomp/CmpDescribe.cpp        |  36 ++++--
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp |   4 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp |  47 ++++++--
 core/sql/ustat/hs_cli.cpp               |  10 --
 core/sql/ustat/hs_la.cpp                |  15 +++
 16 files changed, 444 insertions(+), 64 deletions(-)
----------------------------------------------------------------------