TDH Hive 分区 抛出无权限异常
异常日志
SQL 错误 [20388] [42000]: COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=xxxxxxxxxxxxxx]]
java.sql.SQLException: COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=xxxxxxxxxx]]
COMPILE FAILED: Internal error HiveAccessControlException: [Error 20388] Permission denied: Principal [name=hive, type=USER] does not have following privileges for operation ALTERTABLE_ADDPARTS [[OBJECT OWNERSHIP] on Object [type=DFS_URI, name=/xxxxxxxxxxxxx]]
执行过程中出现User hive is not a super user
[root@node ~]# hdfs dfs -chown hive:hive xxxx
2019-12-16 11:26:47,085 INFO util.KerberosUtil: Using principal pattern: HTTP/_HOST
chown: changing ownership of '/xxx/xxx/xxx': User hive is not a super user (non-super user cannot change owner).
需要配置hadoop的user环境变量
export HADOOP_USER_name=hdfs
解决方法
需要将hdfs文件制定到hive:hive的用户组下
hdfs dfs -chown -R hive:hive /xxx/xxx
再次执行alter table xxx add partition 问题解决