HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs {
Posted 子墨言良
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs {相关的知识,希望对你有一定的参考价值。
今天用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 {的主要内容,如果未能解决你的问题,请参考以下文章
Hive问题:Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask
osm2pgsql windows “illegal option -W” error
Ubuntu W: GPG error: http://archive.ubuntukey....NO_PUBKEY 8D5A09
如何解决 KeyError: 'val_mean_absolute_error' Keras 2.3.1 and TensorFlow 2.0 From Chollet Deep Learning w
W: GPG error: http://ppa.launchpad.net trusty InRelease: The following signatures couldn't be ve