0

I've followed the guide step by step. But error occured when I tried to grant privilege to the role:

0: jdbc:hive2://localhost:10000/> GRANT ALL ON SERVER server1 TO ROLE admin_role;
Error: Error while compiling statement: FAILED: NullPointerException privilegeObj is null for 
TOK_GRANT
   TOK_PRIVILEGE_LIST
      TOK_PRIVILEGE
         TOK_PRIV_ALL
   TOK_PRINCIPAL_NAME
      TOK_ROLE
         admin_role
   TOK_PRIV_OBJECT
      TOK_SERVER_TYPE
         server1 (state=42000,code=40000)

I'm login to beeline as hive and the password is correct, create role is ok, and i can see the roles:

0: jdbc:hive2://localhost:10000/> show roles;
+-------------+--+
|    role     |
+-------------+--+
| test        |
| admin_role  |
+-------------+--+

but I cannot get current roles:

0: jdbc:hive2://localhost:10000/> show current roles;
+-------+--+
| role  |
+-------+--+
+-------+--+
kiwi
  • 487
  • 1
  • 4
  • 16

2 Answers2

0

This query lists all the roles assigned to the logged in user groups:

SHOW CURRENT ROLES;

I guess that, in your case, user hive belongs to the group hive (group in hdfs permissions meaning). You can check which roles are granted to group hive:

SHOW ROLE GRANT GROUP hive;

If you don't see admin_role, you can grant it with this statement:

GRANT ROLE admin_role TO GROUP hive;
Piotr Reszke
  • 1,576
  • 9
  • 21
Artur I
  • 51
  • 4
0

Found the reason:

hive-exec.jar of sentry and hive come frem DIFFERENT versions. The constants, such as :TOK_PRIV_OBJECT, in the two jars has different values.

Really tricky!

kiwi
  • 487
  • 1
  • 4
  • 16