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/01/21 00:27:29 UTC

[1/2] incubator-trafodion git commit: Various TRAFODION jira fixes, details below.

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master ed2e4fa84 -> f87198f32


Various TRAFODION jira fixes, details below.

TRAFODION-2416 HBASE_OPTIONS on create index are now correctly recreated
after data is removed through purgedata command.

TRAFODION-2401 a foreign key referential constraint with NOT ENFORCED
option no longer creates an index.

TRAFODION-2299 A WITH statement now displays number of rows selected
instead of 'sql operation complete'. This fix is currently only done
for sqlci commands. It still needs to be added to trafci interface.

TRAFODION-1796 During regressions run, if default schema 'SCH'
doesn't already exist, then it is automatically created and updated in
the system defaults table when the first create statement is seen.
This change was added a while back.

TRAFODION-1637 vsbb delete was incorrectly being chosen when deleting rows
from hbase tables in _ROW_ or _CELL_ format. That has been fixed.
In addition, the cqd hbase_delete_costing 'OFF' has been removed
from seabase/TEST022.

hive/TEST007 has been fixed to create a trafodion schema where non-hive
tables/views are created.


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

Branch: refs/heads/master
Commit: a9ce210789df5082a2fb8dd6d808937022208adf
Parents: ed2e4fa
Author: Anoop Sharma <an...@esgyn.com>
Authored: Fri Jan 20 16:50:52 2017 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Fri Jan 20 16:50:52 2017 +0000

----------------------------------------------------------------------
 core/sql/generator/GenPreCode.cpp           |   4 +-
 core/sql/regress/compGeneral/EXPECTED005    |  54 ++++++------
 core/sql/regress/compGeneral/EXPECTED013.SB |  21 ++---
 core/sql/regress/compGeneral/EXPECTED045    |  30 +++----
 core/sql/regress/hive/EXPECTED007           | 101 ++++++++++++-----------
 core/sql/regress/hive/TEST007               |  76 ++++++++---------
 core/sql/regress/seabase/EXPECTED020        |  24 ++----
 core/sql/regress/seabase/TEST022            |   2 -
 core/sql/sqlci/SqlCmd.cpp                   |   4 +
 core/sql/sqlci/sqlci_yacc.y                 |   8 +-
 core/sql/sqlcomp/CmpSeabaseDDL.h            |   1 +
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp    |   3 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp     |   7 ++
 13 files changed, 165 insertions(+), 170 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenPreCode.cpp b/core/sql/generator/GenPreCode.cpp
index 6551132..ddd7526 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -4994,7 +4994,9 @@ RelExpr * HbaseDelete::preCodeGen(Generator * generator,
  
   NABoolean hbaseRowsetVSBBopt = 
     (CmpCommon::getDefault(HBASE_ROWSET_VSBB_OPT) == DF_ON);
-  if (getTableDesc()->getNATable()->isHbaseMapTable())
+  if ((getTableDesc()->getNATable()->isHbaseMapTable()) ||
+      (getTableDesc()->getNATable()->isHbaseRowTable()) ||
+      (getTableDesc()->getNATable()->isHbaseCellTable()))
     hbaseRowsetVSBBopt = FALSE;
 
   if (getInliningInfo().isIMGU()) {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/compGeneral/EXPECTED005
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED005 b/core/sql/regress/compGeneral/EXPECTED005
index c42c814..d898ec6 100755
--- a/core/sql/regress/compGeneral/EXPECTED005
+++ b/core/sql/regress/compGeneral/EXPECTED005
@@ -1057,50 +1057,50 @@ DNO                   DNAME                 ENO          DNO
 +>w2 as (select * from w1)
 +>select * from w2;
 
-C1 C2
-----------
+C1           C2         
+-----------  -----------
 
- 1 1
- 2 2
- 3 3
- 4 4
- 5 5
+          1            1
+          2            2
+          3            3
+          4            4
+          5            5
 
---- SQL operation complete.
+--- 5 row(s) selected.
 >>
 >>with w1 as (select c1, c2 from witht1),
 +>w2 as (select c1,c2 from witht2)
 +>select * from w1 , w2 where w1.c1 = w2.c1;
 
-C1 C2 C1 C2
-----------
+C1           C2           C1           C2         
+-----------  -----------  -----------  -----------
 
- 3 3 3 3
- 4 4 4 4
- 5 5 5 5
+          3            3            3            3
+          4            4            4            4
+          5            5            5            5
 
---- SQL operation complete.
+--- 3 row(s) selected.
 >>
 >>with w1 as (select * from witht1)
 +>select * from w1
 +>union all
 +>select * from w1;
 
-C1 C2
-----------
+C1           C2         
+-----------  -----------
 
- 1 1
- 1 1
- 2 2
- 2 2
- 3 3
- 3 3
- 4 4
- 4 4
- 5 5
- 5 5
+          1            1
+          1            1
+          2            2
+          2            2
+          3            3
+          3            3
+          4            4
+          4            4
+          5            5
+          5            5
 
---- SQL operation complete.
+--- 10 row(s) selected.
 >>
 >>with recursive w1 as (select c1, c2 from witht1 union all select origin.c1 , origin.c2 from w1 join t1 origin on origin.c1 = w1.c1 );
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/compGeneral/EXPECTED013.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED013.SB b/core/sql/regress/compGeneral/EXPECTED013.SB
index 7d59c34..685f1c7 100644
--- a/core/sql/regress/compGeneral/EXPECTED013.SB
+++ b/core/sql/regress/compGeneral/EXPECTED013.SB
@@ -84,13 +84,6 @@ CREATE TABLE TRAFODION.SCH.ORDERS
  ATTRIBUTES ALIGNED FORMAT
 ;
 
--- The following index is a system created index --
-CREATE INDEX CONS11 ON TRAFODION.SCH.ORDERS
-  (
-    O_CUSTKEY ASC
-  )
-;
-
 ALTER TABLE TRAFODION.SCH.ORDERS ADD CONSTRAINT TRAFODION.SCH.CONS11 FOREIGN
   KEY
   (
@@ -116,14 +109,14 @@ CREATE TABLE TRAFODION.SCH.ORDERS1
 ;
 
 -- The following index is a system created index --
-CREATE INDEX ORDERS1_256625783_9645 ON TRAFODION.SCH.ORDERS1
+CREATE INDEX ORDERS1_277948757_4279 ON TRAFODION.SCH.ORDERS1
   (
     O_CUSTKEY ASC
   )
 ;
 
 ALTER TABLE TRAFODION.SCH.ORDERS1 ADD CONSTRAINT
-  TRAFODION.SCH.ORDERS1_256625783_9645 FOREIGN KEY
+  TRAFODION.SCH.ORDERS1_277948757_4279 FOREIGN KEY
   (
     O_CUSTKEY
   )
@@ -146,14 +139,14 @@ CREATE TABLE TRAFODION.SCH.ORDERS2
 ;
 
 -- The following index is a system created index --
-CREATE INDEX ORDERS2_838925783_9645 ON TRAFODION.SCH.ORDERS2
+CREATE INDEX ORDERS2_417358757_4279 ON TRAFODION.SCH.ORDERS2
   (
     O_CUSTKEY ASC
   )
 ;
 
 ALTER TABLE TRAFODION.SCH.ORDERS2 ADD CONSTRAINT
-  TRAFODION.SCH.ORDERS2_838925783_9645 FOREIGN KEY
+  TRAFODION.SCH.ORDERS2_417358757_4279 FOREIGN KEY
   (
     O_CUSTKEY
   )
@@ -174,11 +167,9 @@ OPERATOR
 ----------------
 
 ROOT            
-NESTED_JOIN     
-TRAFODION_INSERT
 TRAFODION_INSERT
 
---- 4 row(s) selected.
+--- 2 row(s) selected.
 >>
 >>prepare XX from insert into orders1 values(1,1);
 
@@ -709,7 +700,7 @@ OPERATOR
 ----------------
 
 ROOT            
-NESTED_JOIN     
+HYBRID_HASH_JOIN
 SCAN            
 SORT_SCALAR_AGGR
 SCAN            

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/compGeneral/EXPECTED045
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED045 b/core/sql/regress/compGeneral/EXPECTED045
index 6489b5d..18f94eb 100644
--- a/core/sql/regress/compGeneral/EXPECTED045
+++ b/core/sql/regress/compGeneral/EXPECTED045
@@ -519,7 +519,7 @@ SCAN TEMP                                          2
                10436
                10436
 
---- SQL operation complete.
+--- 2 row(s) selected.
 >>-- execute a second time
 >>execute s using 2;
 
@@ -529,7 +529,7 @@ SCAN TEMP                                          2
                10436
                10436
 
---- SQL operation complete.
+--- 2 row(s) selected.
 >>
 >>-- prepare a second time, so far not using query cache
 >>prepare s from
@@ -557,7 +557,7 @@ SCAN TEMP                                          2
                10435
                10435
 
---- SQL operation complete.
+--- 2 row(s) selected.
 >>-- execute a second time
 >>execute s using 4;
 
@@ -567,7 +567,7 @@ SCAN TEMP                                          2
                10437
                10437
 
---- SQL operation complete.
+--- 2 row(s) selected.
 >>
 >>-- test subquery unnesting
 >>cqd subquery_unnesting 'debug';
@@ -648,7 +648,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>
 >>--QID: 2
@@ -728,7 +728,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>
 >>--QID: 4
@@ -861,7 +861,7 @@ SCAN TEMP                                          6
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>
 >>--QID: 11
@@ -959,7 +959,7 @@ SCAN TEMP                                          4
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>--QID: 14a
 >>
@@ -1166,7 +1166,7 @@ CHANNEL  I_BRAND_ID   I_CLASS_ID   I_CATEGORY_ID  SUM_SALES             NUMBER_S
 
 ?                  ?            ?              ?                     ?                     ?
 
---- SQL operation complete.
+--- 1 row(s) selected.
 >>
 >>--QID: 23a
 >>
@@ -1251,7 +1251,7 @@ SCAN TEMP                                          2
 
                    ?
 
---- SQL operation complete.
+--- 1 row(s) selected.
 >>
 >>--QID: 23b
 >>
@@ -1337,7 +1337,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>--QID: 24a
 >>
@@ -1408,7 +1408,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>--QID: 24b
 >>
@@ -1479,7 +1479,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>--QID: 30
 >>
@@ -1528,7 +1528,7 @@ SCAN TEMP                                          2
 --- 3 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>
 >>--QID: 31
 >>
@@ -1594,7 +1594,7 @@ SCAN TEMP                                          2
 --- 0 row(s) selected.
 >>execute s;
 
---- SQL operation complete.
+--- 0 row(s) selected.
 >>obey TEST045(clnup);
 >>
 >>drop schema T045_CSES cascade;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/hive/EXPECTED007
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED007 b/core/sql/regress/hive/EXPECTED007
index 85e0dfc..14ba827 100644
--- a/core/sql/regress/hive/EXPECTED007
+++ b/core/sql/regress/hive/EXPECTED007
@@ -5,6 +5,9 @@
 >>cqd HIVE_MAX_STRING_LENGTH '20' ;
 
 --- SQL operation complete.
+>>create schema if not exists trafodion.sch007;
+
+--- SQL operation complete.
 >>
 >>obey TEST007(tests);
 >>-- tests for views on hive tables
@@ -26,7 +29,7 @@
 
 --- SQL operation complete.
 >>
->>create view trafodion.sch.vhive1 as select * from thive1;
+>>create view trafodion.sch007.vhive1 as select * from thive1;
 
 --- SQL operation complete.
 >>showddl hive.hive.thive1;
@@ -48,35 +51,35 @@ CREATE EXTERNAL TABLE THIVE1
 
 --- SQL operation complete.
 >>
->>create view trafodion.sch.vhive11 as select * from thive2;
+>>create view trafodion.sch007.vhive11 as select * from thive2;
 
 --- SQL operation complete.
->>create view trafodion.sch.vhive2 as select x.a, y.b from thive1 x, thive2 y
+>>create view trafodion.sch007.vhive2 as select x.a, y.b from thive1 x, thive2 y
 +>  where x.a < 2 and x.b = y.b;
 
 --- SQL operation complete.
->>create view trafodion.sch.vhive3 as select * from trafodion.sch.vhive2;
+>>create view trafodion.sch007.vhive3 as select * from trafodion.sch007.vhive2;
 
 --- SQL operation complete.
 >>
 >>-- view on hive and traf tables
->>drop table if exists trafodion.sch.thbase1;
+>>drop table if exists trafodion.sch007.thbase1;
 
 --- SQL operation complete.
->>create table trafodion.sch.thbase1 (aa int, bb int);
+>>create table trafodion.sch007.thbase1 (aa int, bb int);
 
 --- SQL operation complete.
->>create view trafodion.sch.vhivehbase as select * from 
-+>        trafodion.sch.thbase1, thive2 where a = aa;
+>>create view trafodion.sch007.vhivehbase as select * from 
++>        trafodion.sch007.thbase1, thive2 where a = aa;
 
 --- SQL operation complete.
->>insert into trafodion.sch.thbase1 values (1,2);
+>>insert into trafodion.sch007.thbase1 values (1,2);
 
 --- 1 row(s) inserted.
->>invoke trafodion.sch.vhivehbase;
+>>invoke trafodion.sch007.vhivehbase;
 
--- Definition of Trafodion view TRAFODION.SCH.VHIVEHBASE
--- Definition current  Wed Jan 18 20:20:24 2017
+-- Definition of Trafodion view TRAFODION.SCH007.VHIVEHBASE
+-- Definition current  Fri Jan 20 16:31:37 2017
 
   (
     AA                               INT DEFAULT NULL
@@ -86,7 +89,7 @@ CREATE EXTERNAL TABLE THIVE1
   )
 
 --- SQL operation complete.
->>select * from trafodion.sch.vhivehbase;
+>>select * from trafodion.sch007.vhivehbase;
 
 AA           BB           A            B          
 -----------  -----------  -----------  -----------
@@ -103,7 +106,7 @@ A            B
           1            2
 
 --- 1 row(s) selected.
->>insert into trafodion.sch.vhive1 values (3,4);
+>>insert into trafodion.sch007.vhive1 values (3,4);
 
 --- 1 row(s) inserted.
 >>select * from thive1;
@@ -116,7 +119,7 @@ A            B
 
 --- 2 row(s) selected.
 >>
->>prepare s from select * from trafodion.sch.vhive1;
+>>prepare s from select * from trafodion.sch007.vhive1;
 
 --- SQL command prepared.
 >>explain options 'f' s;
@@ -138,7 +141,7 @@ A            B
 
 --- 2 row(s) selected.
 >>
->>prepare s from select * from trafodion.sch.vhive2;
+>>prepare s from select * from trafodion.sch007.vhive2;
 
 --- SQL command prepared.
 >>explain options 'f' s;
@@ -161,7 +164,7 @@ A            B
 
 --- 1 row(s) selected.
 >>
->>prepare s from select * from trafodion.sch.vhive3;
+>>prepare s from select * from trafodion.sch007.vhive3;
 
 --- SQL command prepared.
 >>explain options 'f' s;
@@ -184,38 +187,38 @@ A            B
 
 --- 1 row(s) selected.
 >>
->>get tables in view trafodion.sch.vhive1;
+>>get tables in view trafodion.sch007.vhive1;
 
-Tables in View SCH.VHIVE1
-=========================
+Tables in View SCH007.VHIVE1
+============================
 
 HIVE.HIVE.THIVE1
 
 --- SQL operation complete.
->>get tables in view trafodion.sch.vhive11;
+>>get tables in view trafodion.sch007.vhive11;
 
-Tables in View SCH.VHIVE11
-==========================
+Tables in View SCH007.VHIVE11
+=============================
 
 HIVE.HIVE.THIVE2
 
 --- SQL operation complete.
 >>
->>get all tables in view trafodion.sch.vhive3;
+>>get all tables in view trafodion.sch007.vhive3;
 
-Tables in View SCH.VHIVE3
-=========================
+Tables in View SCH007.VHIVE3
+============================
 
 HIVE.HIVE.THIVE1
 HIVE.HIVE.THIVE2
 
 --- SQL operation complete.
->>get views in view trafodion.sch.vhive3;
+>>get views in view trafodion.sch007.vhive3;
 
-Views in View SCH.VHIVE3
-========================
+Views in View SCH007.VHIVE3
+===========================
 
-TRAFODION.SCH.VHIVE2
+TRAFODION.SCH007.VHIVE2
 
 --- SQL operation complete.
 >>get views on table hive.hive.thive1;
@@ -223,8 +226,8 @@ TRAFODION.SCH.VHIVE2
 Views on Table _HV_HIVE_.THIVE1
 ===============================
 
-SCH.VHIVE1
-SCH.VHIVE2
+SCH007.VHIVE1
+SCH007.VHIVE2
 
 --- SQL operation complete.
 >>get all views on table hive.hive.thive2;
@@ -232,10 +235,10 @@ SCH.VHIVE2
 Views on Table _HV_HIVE_.THIVE2
 ===============================
 
-SCH.VHIVE11
-SCH.VHIVE2
-SCH.VHIVE3
-SCH.VHIVEHBASE
+SCH007.VHIVE11
+SCH007.VHIVE2
+SCH007.VHIVE3
+SCH007.VHIVEHBASE
 
 --- SQL operation complete.
 >>
@@ -254,9 +257,9 @@ CREATE TABLE THIVE2
 ;
 
 --- SQL operation complete.
->>showddl trafodion.sch.vhive3;
+>>showddl trafodion.sch007.vhive3;
 
-*** ERROR[4082] Object TRAFODION.SCH.VHIVE3 does not exist or is inaccessible.
+*** ERROR[4082] Object TRAFODION.SCH007.VHIVE3 does not exist or is inaccessible.
 
 --- SQL operation failed with errors.
 >>get all views on table hive.hive.thive2;
@@ -265,26 +268,26 @@ CREATE TABLE THIVE2
 >>
 >>obey TEST007(error_tests);
 >>
->>create view trafodion.sch.vhive4 as select x.a, y.b from thive1 x, thive1 y;
+>>create view trafodion.sch007.vhive4 as select x.a, y.b from thive1 x, thive1 y;
 
 --- SQL operation complete.
 >>
 >>-- insert not allowed
->>insert into trafodion.sch.vhive4 values (3,4);
+>>insert into trafodion.sch007.vhive4 values (3,4);
 
-*** ERROR[4027] Table or view TRAFODION.SCH.VHIVE4 does not permit insertions.
+*** ERROR[4027] Table or view TRAFODION.SCH007.VHIVE4 does not permit insertions.
 
 *** ERROR[8822] The statement was not prepared.
 
 >>
 >>-- del/upd not allowed
->>delete from trafodion.sch.vhive1;
+>>delete from trafodion.sch007.vhive1;
 
 *** ERROR[4223] Update/Delete on Hive table is not supported in this software version.
 
 *** ERROR[8822] The statement was not prepared.
 
->>update trafodion.sch.vhive1 set b = 1;
+>>update trafodion.sch007.vhive1 set b = 1;
 
 *** ERROR[4223] Update/Delete on Hive table is not supported in this software version.
 
@@ -292,9 +295,9 @@ CREATE TABLE THIVE2
 
 >>
 >>--  traf view is not updatable
->>delete from trafodion.sch.vhive4;
+>>delete from trafodion.sch007.vhive4;
 
-*** ERROR[4028] Table or view TRAFODION.SCH.VHIVE4 is not updatable.
+*** ERROR[4028] Table or view TRAFODION.SCH007.VHIVE4 is not updatable.
 
 *** ERROR[8822] The statement was not prepared.
 
@@ -308,7 +311,7 @@ CREATE TABLE THIVE2
 
 >>
 >>-- if underlying hive table is dropped, an error is returned
->>prepare s from select * from trafodion.sch.vhive1;
+>>prepare s from select * from trafodion.sch007.vhive1;
 
 --- SQL command prepared.
 >>execute s;
@@ -327,7 +330,7 @@ A            B
 *** ERROR[8442] Unable to access HDFS interface. Call to ExpLOBInterfaceDataModCheck returned error LOB_DATA_FILE_NOT_FOUND_ERROR(554). Error detail 0.
 
 --- 0 row(s) selected.
->>select * from trafodion.sch.vhive1;
+>>select * from trafodion.sch007.vhive1;
 
 *** ERROR[1388] Object HIVE.HIVE.THIVE1 does not exist in hive metadata.
 
@@ -343,7 +346,7 @@ A            B
 >>sh regrhive.ksh -f TEST007_junk;
 >>sh echo "create table thive3(a int, b int);" > TEST007_junk;
 >>sh regrhive.ksh -f TEST007_junk;
->>create view trafodion.sch.vhive6 as select * from hive.hive.thive3;
+>>create view trafodion.sch007.vhive6 as select * from hive.hive.thive3;
 
 *** WARNING[1071] View usage information for the following hive tables could not be set. Make sure that an external table either already exists or implicit creation has not been disabled. Hive tables: HIVE.HIVE.THIVE3
 
@@ -363,7 +366,7 @@ CREATE TABLE THIVE3
 >>get all views on table hive.hive.thive3;
 
 --- SQL operation complete.
->>get all tables in view trafodion.sch.vhive6;
+>>get all tables in view trafodion.sch007.vhive6;
 
 --- SQL operation complete.
 >>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/hive/TEST007
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST007 b/core/sql/regress/hive/TEST007
index 2fedc47..1e1a555 100644
--- a/core/sql/regress/hive/TEST007
+++ b/core/sql/regress/hive/TEST007
@@ -34,15 +34,16 @@ exit;
 ?section setup
 set schema hive.hive;
 cqd HIVE_MAX_STRING_LENGTH '20' ;
+create schema if not exists trafodion.sch007;
 
 ?section clean_up
-drop view trafodion.sch.vhive1 cascade;
-drop view trafodion.sch.vhive11 cascade;
-drop view trafodion.sch.vhive2 cascade;
-drop view trafodion.sch.vhive3 cascade;
-drop view trafodion.sch.vhive4 cascade;
-drop view trafodion.sch.vhive5 cascade;
-drop view trafodion.sch.vhive6 cascade;
+drop view trafodion.sch007.vhive1 cascade;
+drop view trafodion.sch007.vhive11 cascade;
+drop view trafodion.sch007.vhive2 cascade;
+drop view trafodion.sch007.vhive3 cascade;
+drop view trafodion.sch007.vhive4 cascade;
+drop view trafodion.sch007.vhive5 cascade;
+drop view trafodion.sch007.vhive6 cascade;
 drop external table thive1 for hive.hive.thive1 cascade;
 cleanup table trafodion."_HV_HIVE_".thive1;
 drop external table thive2 for hive.hive.thive2 cascade;
@@ -53,7 +54,8 @@ sh regrhive.ksh -f TEST007_junk;
 drop external table thive3 for hive.hive.thive3;
 sh echo "drop table thive3;" > TEST007_junk;
 sh regrhive.ksh -f TEST007_junk;
-drop table if exists trafodion.sch.thbase1 cascade;
+drop table if exists trafodion.sch007.thbase1 cascade;
+drop schema trafodion.sch007 cascade;
 
 ?section tests
 -- tests for views on hive tables
@@ -73,76 +75,76 @@ sh regrhive.ksh -f TEST007_junk;
 
 create external table thive2 for hive.hive.thive2;
 
-create view trafodion.sch.vhive1 as select * from thive1;
+create view trafodion.sch007.vhive1 as select * from thive1;
 showddl hive.hive.thive1;
 
-create view trafodion.sch.vhive11 as select * from thive2;
-create view trafodion.sch.vhive2 as select x.a, y.b from thive1 x, thive2 y
+create view trafodion.sch007.vhive11 as select * from thive2;
+create view trafodion.sch007.vhive2 as select x.a, y.b from thive1 x, thive2 y
   where x.a < 2 and x.b = y.b;
-create view trafodion.sch.vhive3 as select * from trafodion.sch.vhive2;
+create view trafodion.sch007.vhive3 as select * from trafodion.sch007.vhive2;
 
 -- view on hive and traf tables
-drop table if exists trafodion.sch.thbase1;
-create table trafodion.sch.thbase1 (aa int, bb int);
-create view trafodion.sch.vhivehbase as select * from 
-        trafodion.sch.thbase1, thive2 where a = aa;
-insert into trafodion.sch.thbase1 values (1,2);
-invoke trafodion.sch.vhivehbase;
-select * from trafodion.sch.vhivehbase;
+drop table if exists trafodion.sch007.thbase1;
+create table trafodion.sch007.thbase1 (aa int, bb int);
+create view trafodion.sch007.vhivehbase as select * from 
+        trafodion.sch007.thbase1, thive2 where a = aa;
+insert into trafodion.sch007.thbase1 values (1,2);
+invoke trafodion.sch007.vhivehbase;
+select * from trafodion.sch007.vhivehbase;
 
 select * from thive1;
-insert into trafodion.sch.vhive1 values (3,4);
+insert into trafodion.sch007.vhive1 values (3,4);
 select * from thive1;
 
-prepare s from select * from trafodion.sch.vhive1;
+prepare s from select * from trafodion.sch007.vhive1;
 explain options 'f' s;
 execute s;
 
-prepare s from select * from trafodion.sch.vhive2;
+prepare s from select * from trafodion.sch007.vhive2;
 explain options 'f' s;
 execute s;
 
-prepare s from select * from trafodion.sch.vhive3;
+prepare s from select * from trafodion.sch007.vhive3;
 explain options 'f' s;
 execute s;
 
-get tables in view trafodion.sch.vhive1;
-get tables in view trafodion.sch.vhive11;
+get tables in view trafodion.sch007.vhive1;
+get tables in view trafodion.sch007.vhive11;
 
-get all tables in view trafodion.sch.vhive3;
-get views in view trafodion.sch.vhive3;
+get all tables in view trafodion.sch007.vhive3;
+get views in view trafodion.sch007.vhive3;
 get views on table hive.hive.thive1;
 get all views on table hive.hive.thive2;
 
 drop external table thive2 for hive.hive.thive2 cascade;
 showddl hive.hive.thive2;
-showddl trafodion.sch.vhive3;
+showddl trafodion.sch007.vhive3;
 get all views on table hive.hive.thive2;
 
 ?section error_tests
 
-create view trafodion.sch.vhive4 as select x.a, y.b from thive1 x, thive1 y;
+create view trafodion.sch007.vhive4 as select x.a, y.b from thive1 x, thive1 y;
 
 -- insert not allowed
-insert into trafodion.sch.vhive4 values (3,4);
+insert into trafodion.sch007.vhive4 values (3,4);
 
 -- del/upd not allowed
-delete from trafodion.sch.vhive1;
-update trafodion.sch.vhive1 set b = 1;
+delete from trafodion.sch007.vhive1;
+update trafodion.sch007.vhive1 set b = 1;
 
 --  traf view is not updatable
-delete from trafodion.sch.vhive4;
+delete from trafodion.sch007.vhive4;
 
 -- traf view must be in traf cat/sch
 create view vhive5 as select * from thive1;
 
 -- if underlying hive table is dropped, an error is returned
-prepare s from select * from trafodion.sch.vhive1;
+prepare s from select * from trafodion.sch007.vhive1;
 execute s;
 sh echo "drop table thive1;" > TEST007_junk;
 sh regrhive.ksh -f TEST007_junk;
 execute s;
-select * from trafodion.sch.vhive1;
+select * from trafodion.sch007.vhive1;
 
 -- if external table creation has been disabled, then view usage will
 -- not available
@@ -151,8 +153,8 @@ sh echo "drop table thive3;" > TEST007_junk;
 sh regrhive.ksh -f TEST007_junk;
 sh echo "create table thive3(a int, b int);" > TEST007_junk;
 sh regrhive.ksh -f TEST007_junk;
-create view trafodion.sch.vhive6 as select * from hive.hive.thive3;
+create view trafodion.sch007.vhive6 as select * from hive.hive.thive3;
 showddl hive.hive.thive3;
 get all views on table hive.hive.thive3;
-get all tables in view trafodion.sch.vhive6;
+get all tables in view trafodion.sch007.vhive6;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/seabase/EXPECTED020
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED020 b/core/sql/regress/seabase/EXPECTED020
index b3e799d..48cef66 100644
--- a/core/sql/regress/seabase/EXPECTED020
+++ b/core/sql/regress/seabase/EXPECTED020
@@ -6,7 +6,7 @@
 >>invoke test020t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T1
--- Definition current  Tue Sep 20 10:02:55 2016
+-- Definition current  Thu Jan 19 17:38:24 2017
 
   (
     C1                               INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -50,7 +50,7 @@ C1           C2
 >>invoke test020t2;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T2
--- Definition current  Tue Sep 20 10:02:59 2016
+-- Definition current  Thu Jan 19 17:38:28 2017
 
   (
     C                                CHAR(15) CHARACTER SET ISO88591 COLLATE
@@ -163,7 +163,7 @@ G0
 >>invoke test020t5;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T5
--- Definition current  Tue Sep 20 10:03:25 2016
+-- Definition current  Thu Jan 19 17:38:51 2017
 
   (
     C                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -264,7 +264,7 @@ ALTER TABLE TRAFODION.SCH.TEST020T5 ADD CONSTRAINT TRAFODION.SCH.TEST020T5C1
 >>invoke test020t6;
 
 -- Definition of Trafodion table TRAFODION.SCH.TEST020T6
--- Definition current  Tue Sep 20 10:04:46 2016
+-- Definition current  Thu Jan 19 17:40:10 2017
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -3137,13 +3137,6 @@ CREATE TABLE TRAFODION.SCH.TEST020_T34
  ATTRIBUTES ALIGNED FORMAT
 ;
 
--- The following index is a system created index --
-CREATE INDEX T34_1 ON TRAFODION.SCH.TEST020_T34
-  (
-    B ASC
-  )
-;
-
 ALTER TABLE TRAFODION.SCH.TEST020_T34 ADD CONSTRAINT TRAFODION.SCH.T34_1
   FOREIGN KEY
   (
@@ -3184,13 +3177,6 @@ CREATE TABLE TRAFODION.SCH.TEST020_T34
  ATTRIBUTES ALIGNED FORMAT
 ;
 
--- The following index is a system created index --
-CREATE INDEX T34_1 ON TRAFODION.SCH.TEST020_T34
-  (
-    B ASC
-  )
-;
-
 ALTER TABLE TRAFODION.SCH.TEST020_T34 ADD CONSTRAINT TRAFODION.SCH.T34_1
   FOREIGN KEY
   (
@@ -3937,7 +3923,7 @@ C1           C2
 --- 2 row(s) selected.
 >>
 >>obey TEST020(trafodion_2247);
->>create table test020t44(a char(15) not null primary key,b int)
+>>create table test020t44(a char(15) not null primary key,b int) 
 +>attribute aligned format;
 
 --- SQL operation complete.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/regress/seabase/TEST022
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/TEST022 b/core/sql/regress/seabase/TEST022
index 80fdaa0..e8e9d13 100644
--- a/core/sql/regress/seabase/TEST022
+++ b/core/sql/regress/seabase/TEST022
@@ -23,8 +23,6 @@
 
 obey TEST022(clean_up);
 
-cqd hbase_delete_costing 'off';
-
 log LOG022 clear;
 
 cqd hbase_native_iud 'ON';

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/sqlci/SqlCmd.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlci/SqlCmd.cpp b/core/sql/sqlci/SqlCmd.cpp
index be0fc05..0ceb174 100644
--- a/core/sql/sqlci/SqlCmd.cpp
+++ b/core/sql/sqlci/SqlCmd.cpp
@@ -2097,6 +2097,10 @@ short SqlCmd::do_execute(SqlciEnv * sqlci_env,
 	   (prep_stmt->queryType() == SQL_INSERT_NON_UNIQUE))
     stmt_type = DML_INSERT_TYPE;
   else if ((stmt_type == DML_DDL_TYPE) &&
+	   ((prep_stmt->queryType() == SQL_SELECT_NON_UNIQUE) ||
+            (prep_stmt->queryType() == SQL_SELECT_UNIQUE)))
+    stmt_type = DML_SELECT_TYPE;
+  else if ((stmt_type == DML_DDL_TYPE) &&
       (queryType == SQL_EXE_UTIL && subqueryType == SQL_STMT_CTAS))
     stmt_type = DML_INSERT_TYPE;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/sqlci/sqlci_yacc.y
----------------------------------------------------------------------
diff --git a/core/sql/sqlci/sqlci_yacc.y b/core/sql/sqlci/sqlci_yacc.y
index ba6feac..6ff169c 100644
--- a/core/sql/sqlci/sqlci_yacc.y
+++ b/core/sql/sqlci/sqlci_yacc.y
@@ -2178,16 +2178,16 @@ cursor_info : dml_simple_table_type
 dml_type :
 	 	dml_simple_table_type	{}
 	|	CONTROL 		{$$ = DML_CONTROL_TYPE;}
-	|    OSIM               {$$ = DML_OSIM_TYPE;}
+	|       OSIM                    {$$ = DML_OSIM_TYPE;}
 	|	SETtoken CATALOG	{$$ = DML_CONTROL_TYPE;}
 	|	SETtoken SCHEMA		{$$ = DML_CONTROL_TYPE;}
-	|	SETtoken HIVEtoken		{$$ = DML_CONTROL_TYPE;}
+	|	SETtoken HIVEtoken	{$$ = DML_CONTROL_TYPE;}
         |       SETtoken MPLOC          {$$ = DML_CONTROL_TYPE;}
         |       SETtoken NAMETYPE       {$$ = DML_CONTROL_TYPE;}
         |       SETtoken SESSIONtoken   {$$ = DML_CONTROL_TYPE;}
 	|	UPDATEtoken  		{$$ = DML_UPDATE_TYPE;}
-	|	INSERTtoken  		{$$ = DML_INSERT_TYPE;}
-        |      UPSERTtoken            {$$ = DML_INSERT_TYPE;}
+	| 	INSERTtoken  		{$$ = DML_INSERT_TYPE;}
+        |       UPSERTtoken             {$$ = DML_INSERT_TYPE;}
 	|	ROWSETtoken  		{$$ = DML_INSERT_TYPE;}
 	|	DELETEtoken  		{$$ = DML_DELETE_TYPE;}
 	|	MERGEtoken  		{$$ = DML_UPDATE_TYPE;}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 1a010cc..d1816d3 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -950,6 +950,7 @@ protected:
 			NATable * naTable,
 			NABoolean isUnique, // TRUE: uniq constr. FALSE: ref constr.
 			NABoolean noPopulate, // TRUE, dont populate index
+                        NABoolean isEnforced, // TRUE: contraint is enforced
                         NABoolean sameSequenceOfCols, // FALSE, allow "similar" indexes
 			ExeCliInterface *cliInterface);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index a9ab48b..f862963 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -8733,7 +8733,8 @@ void CmpSeabaseDDL::purgedataHbaseTable(DDLExpr * ddlExpr,
               return;
             }
           
-          retcode = createHbaseTable(ehi, &hbaseIndex, SEABASE_DEFAULT_COL_FAMILY);
+          retcode = createHbaseTable(ehi, &hbaseIndex, SEABASE_DEFAULT_COL_FAMILY,
+                                     naf->hbaseCreateOptions());
           if (retcode == -1)
             {
               deallocEHI(ehi); 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a9ce2107/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 4e805a6..93f16be 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -1371,6 +1371,7 @@ short CmpSeabaseDDL::updateIndexInfo(
                                      NATable * naTable,
                                      NABoolean isUnique, // TRUE: uniq constr. FALSE: ref constr.
                                      NABoolean noPopulate,
+                                     NABoolean isEnforced,
                                      NABoolean sameSequenceOfCols,
                                      ExeCliInterface *cliInterface)
 {
@@ -1389,6 +1390,10 @@ short CmpSeabaseDDL::updateIndexInfo(
                                      &existingIndexName))
     createIndex = FALSE;
 
+  // if constraint is not to be enforced, then do not create an index.
+  if (createIndex && (NOT isEnforced))
+    return 0;
+
   ComObjectName indexName(createIndex ? uniqueStr : existingIndexName);
   const NAString catalogNamePart = indexName.getCatalogNamePartAsAnsiString();
   const NAString schemaNamePart = indexName.getSchemaNamePartAsAnsiString(TRUE);
@@ -8023,6 +8028,7 @@ void CmpSeabaseDDL::alterSeabaseTableAddUniqueConstraint(
                       naTable,
                       TRUE,
                       (CmpCommon::getDefault(TRAF_NO_CONSTR_VALIDATION) == DF_ON),
+                      TRUE,
                       FALSE,
                       &cliInterface))
     {
@@ -8634,6 +8640,7 @@ void CmpSeabaseDDL::alterSeabaseTableAddRIConstraint(
                       ringNaTable,
                       FALSE,
                       (CmpCommon::getDefault(TRAF_NO_CONSTR_VALIDATION) == DF_ON),
+                      constraintNode->isEnforced(),
                       TRUE, // because of the way the data is recorded in the
                             // metadata, the indexes of referencing and referenced
                             // tables need to have their columns in the same


[2/2] incubator-trafodion git commit: Merge PR-921 Various TRAFODION jira fixes

Posted by an...@apache.org.
Merge PR-921 Various TRAFODION jira fixes


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

Branch: refs/heads/master
Commit: f87198f320fbf0b6c0f671d65444881f2bc3783b
Parents: ed2e4fa a9ce210
Author: Anoop Sharma <an...@esgyn.com>
Authored: Sat Jan 21 00:27:08 2017 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Sat Jan 21 00:27:08 2017 +0000

----------------------------------------------------------------------
 core/sql/generator/GenPreCode.cpp           |   4 +-
 core/sql/regress/compGeneral/EXPECTED005    |  54 ++++++------
 core/sql/regress/compGeneral/EXPECTED013.SB |  21 ++---
 core/sql/regress/compGeneral/EXPECTED045    |  30 +++----
 core/sql/regress/hive/EXPECTED007           | 101 ++++++++++++-----------
 core/sql/regress/hive/TEST007               |  76 ++++++++---------
 core/sql/regress/seabase/EXPECTED020        |  24 ++----
 core/sql/regress/seabase/TEST022            |   2 -
 core/sql/sqlci/SqlCmd.cpp                   |   4 +
 core/sql/sqlci/sqlci_yacc.y                 |   8 +-
 core/sql/sqlcomp/CmpSeabaseDDL.h            |   1 +
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp    |   3 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp     |   7 ++
 13 files changed, 165 insertions(+), 170 deletions(-)
----------------------------------------------------------------------