You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by rm...@apache.org on 2017/02/01 01:00:48 UTC

[3/4] incubator-trafodion git commit: TRAFODION-2175 a user should only see specific schemas/tables that he has privs

TRAFODION-2175 a user should only see specific schemas/tables that he has privs

Fixed a problem with regression test Hive/TEST009.

The failed test is showing an additional table being stored in NATable cache.
If authorization is enabled, then "get tables" retrieves the list of roles
assigned the current user.  This causes an additional table to be cached.
However, if authorization is off, the role check is not made so the number of
entries in cache is less.  This causes a regressions failure depending on the
environment.

Since this is a test for caching, removed the get table commands from the test to
avoid the mismatch.


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

Branch: refs/heads/master
Commit: 9e925842cc3d8956d2b513c4fecd5a3ac303a125
Parents: 598dc5e
Author: Roberta Marton <rm...@edev07.esgyn.local>
Authored: Tue Jan 31 21:40:52 2017 +0000
Committer: Roberta Marton <rm...@edev07.esgyn.local>
Committed: Tue Jan 31 21:40:52 2017 +0000

----------------------------------------------------------------------
 core/sql/regress/hive/EXPECTED009 | 64 +++++++++++-----------------------
 core/sql/regress/hive/TEST009     |  4 +--
 2 files changed, 22 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9e925842/core/sql/regress/hive/EXPECTED009
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED009 b/core/sql/regress/hive/EXPECTED009
index 5591aaa..900ff3b 100644
--- a/core/sql/regress/hive/EXPECTED009
+++ b/core/sql/regress/hive/EXPECTED009
@@ -197,16 +197,6 @@ A            B            C
 *** ERROR[1118] Creating object TRAFODION."_HV_HIVE_".NEWTABLE3 is not allowed in a reserved system schema.
 
 --- SQL operation failed with errors.
->>get tables;
-
-Tables in Schema TRAFODION._HV_HIVE_
-====================================
-
-CUSTOMER
-ITEM
-PROMOTION
-
---- SQL operation complete.
 >>
 >>-- test creates with a different default schema
 >>create schema hive_t009;
@@ -257,17 +247,6 @@ PROMOTION
 
 --- 10 row(s) inserted.
 >>
->>get tables;
-
-Tables in Schema TRAFODION.HIVE_T009
-====================================
-
-SB_HISTOGRAMS
-SB_HISTOGRAM_INTERVALS
-SB_PERSISTENT_SAMPLES
-T009T1
-
---- SQL operation complete.
 >>drop table t009t1;
 
 --- SQL operation complete.
@@ -335,20 +314,11 @@ HIVE
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_HIVE_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_SCH_T009_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                OBJECTS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
-TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _PRIVMGR_MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                                ROLE_USAGE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 
---- 6 row(s) selected.
+--- 5 row(s) selected.
 >>drop external table t009t1 for hive.sch_t009.t009t1;
 
 --- SQL operation complete.
->>get tables in schema "_HV_SCH_T009_";
-
-Tables in Schema TRAFODION._HV_SCH_T009_
-========================================
-
-T009T2
-
---- SQL operation complete.
 >>select catalog_name, schema_name, object_name from table(natablecacheentries('user','local')) order by 1,2,3;
 
 CATALOG_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      SCHEMA_NAME                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
                                OBJECT_NAME
@@ -359,16 +329,24 @@ HIVE
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_HIVE_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                                PROMOTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _HV_SCH_T009_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
                                T009T2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                                OBJECTS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
-TRAFODION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _PRIVMGR_MD_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
                                ROLE_USAGE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 
---- 6 row(s) selected.
+--- 5 row(s) selected.
 >>create external table t009t1 for hive.sch_t009.t009t1;
 
 --- SQL operation complete.
+>>get tables in schema "_HV_SCH_T009_";
+
+Tables in Schema TRAFODION._HV_SCH_T009_
+========================================
+
+T009T1
+T009T2
+
+--- SQL operation complete.
 >>invoke hive.sch_t009.t009t1;
 
 -- Definition of hive table T009T1
--- Definition current  Wed Jan 25 21:06:12 2017
+-- Definition current  Tue Jan 31 21:32:51 2017
 
   (
     A                                INT
@@ -438,7 +416,7 @@ _HB__CELL__
 >>invoke trafodion."_HB__ROW__"."baseball";
 
 -- Definition of Trafodion external table TRAFODION."_HB__ROW__"."baseball"
--- Definition current  Wed Jan 25 21:06:21 2017
+-- Definition current  Tue Jan 31 21:33:04 2017
 
   (
     ROW_ID                           VARCHAR(100) CHARACTER SET ISO88591
@@ -451,7 +429,7 @@ _HB__CELL__
 >>invoke trafodion."_HB__CELL__"."baseball";
 
 -- Definition of Trafodion external table TRAFODION."_HB__CELL__"."baseball"
--- Definition current  Wed Jan 25 21:06:22 2017
+-- Definition current  Tue Jan 31 21:33:06 2017
 
   (
     ROW_ID                           VARCHAR(100) CHARACTER SET ISO88591
@@ -540,7 +518,7 @@ ROW_ID      COLS
 >>invoke hive.hive.store_sales;
 
 -- Definition of hive table STORE_SALES
--- Definition current  Wed Jan 25 21:06:36 2017
+-- Definition current  Tue Jan 31 21:33:17 2017
 
   (
     SS_SOLD_DATE_SK                  INT
@@ -584,7 +562,7 @@ ROW_ID      COLS
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212352138396921126
+PLAN_ID .................. 212352658397193063
 ROWS_OUT ............. 1,709
 EST_TOTAL_COST ........... 0.27
 STATEMENT ................ select * from store_sales where ss_item_sk = 1;
@@ -713,7 +691,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212352138398271228
+PLAN_ID .................. 212352658398567771
 ROWS_OUT ......... 2,920,643
 EST_TOTAL_COST ........... 1.07
 STATEMENT ................ select *
@@ -915,7 +893,7 @@ DESCRIPTION
 >>invoke hive.hive.date_dim;
 
 -- Definition of hive table DATE_DIM
--- Definition current  Wed Jan 25 21:06:43 2017
+-- Definition current  Tue Jan 31 21:33:22 2017
 
   (
     D_DATE_SK                        INT
@@ -1056,7 +1034,7 @@ CREATE EXTERNAL TABLE DATE_DIM
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212352138408317415
+PLAN_ID .................. 212352658405327436
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select *
@@ -1147,7 +1125,7 @@ DESCRIPTION
 >>invoke hive.hive.date_dim;
 
 -- Definition of hive table DATE_DIM
--- Definition current  Wed Jan 25 21:06:55 2017
+-- Definition current  Tue Jan 31 21:33:32 2017
 
   (
     D_DATE_SK                        INT
@@ -1288,7 +1266,7 @@ CREATE EXTERNAL TABLE DATE_DIM
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... S
-PLAN_ID .................. 212352138418762665
+PLAN_ID .................. 212352658415800073
 ROWS_OUT ................. 1
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select *

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9e925842/core/sql/regress/hive/TEST009
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST009 b/core/sql/regress/hive/TEST009
index 0b7bbb2..520cf75 100755
--- a/core/sql/regress/hive/TEST009
+++ b/core/sql/regress/hive/TEST009
@@ -142,7 +142,6 @@ create table hive_customer like hive.hive.customer;
 create table newtable1 like hive.hive.customer;
 create table newtable2 like customer;
 create table newtable3 (a int);
-get tables;
 
 -- test creates with a different default schema
 create schema hive_t009;
@@ -160,7 +159,6 @@ create table t009t1 like "_HV_SCH_T009_".t009t1;
 drop table t009t1;
 create table t009t1 as select * from hive.sch_t009.t009t1;
 
-get tables;
 drop table t009t1;
 
 drop external table "_HV_HIVE_".customer;
@@ -181,9 +179,9 @@ sh sqlci -i "TEST009(select_stmts)";
 -- drop and recreate external table
 select catalog_name, schema_name, object_name from table(natablecacheentries('user','local')) order by 1,2,3;
 drop external table t009t1 for hive.sch_t009.t009t1;
-get tables in schema "_HV_SCH_T009_";
 select catalog_name, schema_name, object_name from table(natablecacheentries('user','local')) order by 1,2,3;
 create external table t009t1 for hive.sch_t009.t009t1;
+get tables in schema "_HV_SCH_T009_";
 invoke hive.sch_t009.t009t1;
 showddl trafodion."_HV_SCH_T009_".t009t1;