Eric Lin created SENTRY-1646:
--------------------------------
Summary: Unable to truncate table <database>.<tablename>; from
"default" databases
Key: SENTRY-1646
URL: https://issues.apache.org/jira/browse/SENTRY-1646
Project: Sentry
Issue Type: Bug
Components: Hive Plugin
Affects Versions: 1.7.0
Reporter: Eric Lin
Priority: Critical
When the user is doing truncate table <database>.<tablename>; from "default"
databases, it throws below error :
{code}
0: jdbc:hive2://localhost:10000/default> truncate table test.test;
Error: Error while compiling statement: FAILED: SemanticException No valid
privileges
User user1 does not have privileges for TRUNCATETABLE
The required privileges: Server=server1->Db=default->Table=test->action=*;
(state=42000,code=40000)
{code}
It works if user does "use database;" and then runs truncate table:
{code}
0: jdbc:hive2://localhost:10000/default> use test;
INFO : Compiling
command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41): use
test
INFO : Semantic Analysis Completed
INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling
command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41); Time
taken: 0.128 seconds
INFO : Executing
command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41): use
test
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing
command(queryId=hive_20170228141111_654cb0ff-6925-42a4-ba67-a151cd2e4f41); Time
taken: 0.014 seconds
INFO : OK
No rows affected (0.201 seconds)
0: jdbc:hive2://localhost:10000/default> truncate table test.test;
INFO : Compiling
command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1):
truncate table test.test
INFO : Semantic Analysis Completed
INFO : Returning Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling
command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1); Time
taken: 0.111 seconds
INFO : Executing
command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1):
truncate table test.test
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing
command(queryId=hive_20170228141111_2441690e-7523-4525-aeb2-5105e31f51c1); Time
taken: 0.046 seconds
INFO : OK
No rows affected (0.179 seconds)
0: jdbc:hive2://localhost:10000/default>
{code}
The workaround is to grant user permissions to the current data, then the issue
will go away.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)