Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Cannot create external table from command line with hive -f with my own user


Cannot create external table from command line with hive -f with my own user


As my own user (not system user) I cannot create an external table via a .hql script with hive -f.

use db;
create external table `table` (
stored as orc
LOCATION '/external/path/to/my/db/table'
TBLPROPERTIES ("orc.compress"="ZLIB");

I get this

$ hive -f ddl_create_db.table.hql
FAILED: SemanticException MetaException( Permission denied: user=<my-user>, access=EXECUTE, inode="/apps/hive/warehouse/db.db":hdfs:hdfs:d---------
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.check(
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkTraverse(
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(
        at org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer$RangerAccessControlEnforcer.checkDefaultEnforcer(
        at org.apache.ranger.authorization.hadoop.RangerHdfsAuthorizer$RangerAccessControlEnforcer.checkPermission(
        at org.apache.hadoop.hdfs.server.namenode.FSPermissionChecker.checkPermission(
        at org.apache.hadoop.hdfs.server.namenode.FSDirectory.checkPermission(
        at org.apache.hadoop.hdfs.server.namenode.FSDirStatAndListingOp.getFileInfo(
        at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.getFileInfo(
        at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.getFileInfo(
        at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolServerSideTranslatorPB.getFileInfo(
        at org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos$ClientNamenodeProtocol$2.callBlockingMethod(
        at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$
        at org.apache.hadoop.ipc.RPC$
        at org.apache.hadoop.ipc.Server$Handler$
        at org.apache.hadoop.ipc.Server$Handler$
        at Method)
        at org.apache.hadoop.ipc.Server$

Notice it's tryign to access /apps/hive/warehouse/db.db, which I correctly don't have access to with this user, therefore the design requirement to use external tables with another path which I do have access to.

It works fine from Ambari, but not from command line from where I need to script/automate it.


Re: Cannot create external table from command line with hive -f with my own user


It works using beeline instead, with same kinit (as me). Any idea, why it works with beeline and not with hive command?

Don't have an account?
Coming from Hortonworks? Activate your account here