Help Center/ MapReduce Service/ User Guide (Kuala Lumpur Region)/ Troubleshooting/ Using Hive/ An Error Is Reported When the "load data inpath" Command Is Executed
Updated on 2022-12-14 GMT+08:00

An Error Is Reported When the "load data inpath" Command Is Executed

Symptom

The following errors are reported when the load data inpath command is executed:

  • Error 1:
    HiveAccessControlException Permission denied. Principal [name=user1, type=USER] does not have following privileges on Object [type=DFS_URI, name=hdfs://hacluster/tmp/input/mapdata] for operation LOAD : [OBJECT OWNERSHIP]
  • Error 2:
    HiveAccessControlException Permission denied. Principal [name=user1, type=USER] does not have following privileges on Object [type=DFS_URI, name=hdfs://hacluster/tmp/input/mapdata] for operation LOAD : [INSERT, DELETE]
  • Error 3:
    SemanticException [Error 10028]: Line 1:17 Path is not legal ''file:///tmp/input/mapdata'': Move from: file:/tmp/input/mapdata to: hdfs://hacluster/user/hive/warehouse/tmp1 is not valid. Please check that values for params "default.fs.name" and "hive.metastore.warehouse.dir" do not conflict.

Cause Analysis

The current login user does not have the permission to operate the directory or the file directory format is incorrect.

Solution

Hive has the following requirements on the load data inpath command:
  • The file owner must be the user who executes the command.
  • The current user must have read and write permissions for the file.
  • The current user must have permissions to execute the directory of the file.
  • The current user must have the write permission on the directory of the table, because the load operation moves the file to the directory.
  • The file format must be the same as the storage format specified by the table. For example, if stored as rcfile is specified during table creation but the file format is TXT, it is unsatisfied.
  • The file must be stored in HDFS. Files in the local file system cannot be specified using the file:// form.
  • The file name cannot start with an underscore (_) or period (.). A file whose name starts with an underscore (_) or period (.) will be ignored.

    The following shows permissions required when user test_hive loads data.

    [root@192-168-1-18 duan]# hdfs dfs -ls /tmp/input2
    16/03/21 14:45:07 INFO hdfs.PeerCache: SocketCache disabled.
    Found 1 items
    -rw-r--r--   3 test_hive hive          6 2016-03-21 14:44 /tmp/input2/input.txt