Help Center/ MapReduce Service/ User Guide (ME-Abu Dhabi Region)/ Troubleshooting/ Using Hive/ An Error Is Reported When the "create external table" Command Is Executed
Updated on 2022-02-22 GMT+08:00

An Error Is Reported When the "create external table" Command Is Executed

Symptom

The following error is reported when the create external table xx(xx int) stored as textfile location '/tmp/aaa/aaa' command is executed.

Permission denied. Principal [name=fantasy, type=USER] does not have following privileges on Object [type=DFS_URI, name=/tmp/aaa/aaa] for operation CREATETABLE : [SELECT, INSERT, DELETE, OBJECT OWNERSHIP] (state=42000,code=40000)

Cause Analysis

The current login user does not have the read and write permissions for the directory or its parent directory. When an external table is created, whether the current user is checked for its read and write permissions for the specified directory and its subdirectories and subfiles. If the specified directory does not exist, permissions for the parent directory are checked, and so on. If the check results show that the user has no permissions on any directory, "insufficient permission" is reported instead of "The specified directory does not exist".

Solution

Check whether the current user has read and write permissions for the /tmp/aaa/aaa path. If the path does not exist, check whether the user has read and write permissions for its parent directory.