HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }
阿新 • • 發佈:2018-05-24
sed utils erp PE ant ESS java tput 謝謝
今天用Hive的JDBC實例時出現了HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }的錯誤,日誌如下。
org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }
at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java: 231)
at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)
at zimo.hadoop.hive.Hive.main(Hive.java:27)
Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }
at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:314)
at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:102)
at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:171)
at org.apache.hive.service.cli.operation.Operation.run(Operation.java: 256)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:376)
at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:363)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:79)
at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:37)
at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:64)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
at org.apache.hadoop.hive.shims.HadoopShimsSecure.doAs(HadoopShimsSecure.java:536)
at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:60)
at com.sun.proxy.$Proxy22.executeStatementAsync(Unknown Source)
at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:270)
at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:401)
at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
從日誌可以清楚地看出,出現該錯誤的原因是因為我們創建的用戶沒有執行‘Create’操作的權限,所以我們需要將權限授予該用戶。
解決辦法:
hive> set system:user.name=hadoop;
1.給當前用戶權限:
給用戶當前權限:
hive> grant create on database default to user hadoop;
OK
Time taken: 0.146 seconds
或者給用戶所有權限 :
hive> grant all on database default to user hadoop;
OK
Time taken: 0.146 seconds
2.在其他有權限的數據庫裏創建表
比如 當前用戶在db1裏面有權限,而在default裏面是沒有的那麽可以:
use db1;
create table default.test
(
name string
);
這樣也可以創建。
然後,我們的問題就能得到解決了!
以上就是博主為大家介紹的這一板塊的主要內容,這都是博主自己的學習過程,希望能給大家帶來一定的指導作用,有用的還望大家點個支持,如果對你沒用也望包涵,有錯誤煩請指出。如有期待可關註博主以第一時間獲取更新哦,謝謝!
版權聲明:本文為博主原創文章,未經博主允許不得轉載。
HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }