Skip to content

Commit

Permalink
HIVE-8831 : show roles appends dummy new line (Navis via Thejas Nair)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/hive/trunk@1639575 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
ashutoshc committed Nov 14, 2014
1 parent 786a475 commit 142a88c
Show file tree
Hide file tree
Showing 14 changed files with 1 addition and 39 deletions.
3 changes: 1 addition & 2 deletions ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ private void writeListToFileAfterSort(List<String> entries, String resFile) thro
Collections.sort(entries);
StringBuilder sb = new StringBuilder();
for(String entry : entries){
sb.append(entry);
sb.append((char)terminator);
appendNonNull(sb, entry, true);
}
writeToFile(sb.toString(), resFile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
testrole

PREHOOK: query: drop role TESTROLE
PREHOOK: type: DROPROLE
POSTHOOK: query: drop role TESTROLE
Expand All @@ -24,7 +23,6 @@ POSTHOOK: query: show roles
POSTHOOK: type: SHOW_ROLES
admin
public

PREHOOK: query: create role TESTROLE
PREHOOK: type: CREATEROLE
POSTHOOK: query: create role TESTROLE
Expand All @@ -36,7 +34,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
testrole

PREHOOK: query: grant role testROLE to user hive_admin_user
PREHOOK: type: GRANT_ROLE
POSTHOOK: query: grant role testROLE to user hive_admin_user
Expand All @@ -56,7 +53,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
testrole

PREHOOK: query: create role TESTRoLE
PREHOOK: type: CREATEROLE
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Role testrole already exists.
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,4 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

FAILED: HiveAccessControlException Permission denied: Principal [name=user2, type=USER] does not have following privileges for operation DROPDATABASE [[OBJECT OWNERSHIP] on Object [type=TABLE_OR_VIEW, name=dba2.tab2]]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: drop database dba1
PREHOOK: type: DROPDATABASE
PREHOOK: Input: database:dba1
Expand All @@ -37,7 +36,6 @@ POSTHOOK: query: -- check if dropping db as another user fails
show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: create database dba2
PREHOOK: type: CREATEDATABASE
PREHOOK: Output: database:dba2
Expand All @@ -49,5 +47,4 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

FAILED: HiveAccessControlException Permission denied: Principal [name=user2, type=USER] does not have following privileges for operation DROPDATABASE [[OBJECT OWNERSHIP] on Object [type=DATABASE, name=dba2]]
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
admin

PREHOOK: query: create role r1
PREHOOK: type: CREATEROLE
POSTHOOK: query: create role r1
Expand All @@ -21,7 +20,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: drop role r1
PREHOOK: type: DROPROLE
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Current user : hive_admin_user is not allowed to drop role. User has to belong to ADMIN role and have it as current role, for this action.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ show current roles
POSTHOOK: type: SHOW_ROLES
public
role2

PREHOOK: query: grant all on table tpriv_current_role to user user3
PREHOOK: type: GRANT_PRIVILEGE
PREHOOK: Output: default@tpriv_current_role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ admin
mixCaseRole1
mixCaseRole2
public

PREHOOK: query: create table t1(i int)
PREHOOK: type: CREATETABLE
PREHOOK: Output: database:default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand Down Expand Up @@ -64,7 +63,6 @@ public
role1
role2
role3

PREHOOK: query: select * from t1
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
Expand All @@ -78,7 +76,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: grant select on t1 to role role2
PREHOOK: type: GRANT_PRIVILEGE
PREHOOK: Output: default@t1
Expand All @@ -93,7 +90,6 @@ public
role1
role2
role3

PREHOOK: query: select * from t1
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
Expand All @@ -111,7 +107,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
admin

PREHOOK: query: revoke select on table t1 from role role2
PREHOOK: type: REVOKE_PRIVILEGE
PREHOOK: Output: default@t1
Expand Down Expand Up @@ -139,7 +134,6 @@ role1
role2
role3
role4

PREHOOK: query: select * from t1
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
Expand All @@ -153,7 +147,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand All @@ -175,7 +168,6 @@ role1
role2
role3
role4

PREHOOK: query: select * from t1
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
Expand All @@ -189,7 +181,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand All @@ -206,5 +197,4 @@ public
role1
role2
role4

FAILED: HiveAccessControlException Permission denied: Principal [name=user1, type=USER] does not have following privileges for operation QUERY [[SELECT] on Object [type=TABLE_OR_VIEW, name=default.t1]]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand All @@ -25,7 +24,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
admin

PREHOOK: query: select * from t1
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: SHOW CURRENT ROLES
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: -- user2 should be able to do a describe table, as pubic is in the current roles
DESC t_gpr1
PREHOOK: type: DESCTABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
src_role2

PREHOOK: query: -- revoke role without role keyword
revoke src_rolE2 from user user2
PREHOOK: type: REVOKE_ROLE
Expand All @@ -48,7 +47,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
src_role2

PREHOOK: query: ----------------------------------------
-- role granting without role keyword, with admin option (syntax check)
----------------------------------------
Expand Down Expand Up @@ -104,7 +102,6 @@ admin
public
src_role2
src_role_wadmin

PREHOOK: query: drop role Src_role2
PREHOOK: type: DROPROLE
POSTHOOK: query: drop role Src_role2
Expand All @@ -116,7 +113,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
src_role_wadmin

PREHOOK: query: drop role sRc_role_wadmin
PREHOOK: type: DROPROLE
POSTHOOK: query: drop role sRc_role_wadmin
Expand All @@ -127,4 +123,3 @@ POSTHOOK: query: show roles
POSTHOOK: type: SHOW_ROLES
admin
public

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
admin

PREHOOK: query: create role r1
PREHOOK: type: CREATEROLE
POSTHOOK: query: create role r1
Expand All @@ -25,7 +24,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
r1

PREHOOK: query: set role PUBLIC
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role PUBLIC
Expand All @@ -35,7 +33,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ALL
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ALL
Expand All @@ -46,7 +43,6 @@ POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public
r1

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ PREHOOK: type: SHOW_ROLES
POSTHOOK: query: show current roles
POSTHOOK: type: SHOW_ROLES
public

PREHOOK: query: set role ADMIN
PREHOOK: type: SHOW_ROLES
POSTHOOK: query: set role ADMIN
Expand All @@ -206,7 +205,6 @@ POSTHOOK: type: SHOW_ROLES
admin
public
role_v

PREHOOK: query: grant all on table vt2 to role role_v
PREHOOK: type: GRANT_PRIVILEGE
PREHOOK: Output: default@vt2
Expand Down
1 change: 0 additions & 1 deletion ql/src/test/results/clientpositive/show_roles.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ admin
public
role1
role2

0 comments on commit 142a88c

Please sign in to comment.