How does "LOAD DATA LOCAL INPATH" to remote hiveserver

beeline, hadoop, hive

Solution

Just a guess, but based on your description I would say you are pointing to the wrong location.

Presumably you have the file in a 'normal' local directory. In this case you would probably need to refer to it like in one of these two examples:

/tmp/file_20161024.dat

/home/asari/tmp/file_20161024.dat

Note the starting `/`

If your file is actually located in the location that you try now

/opt/hive/bin/tmp/file_20161024.dat

Then please check whether the file has any lines, and what the rights are to access this file. (If you are unsure which rights you need, set the rights fully open and see whether this helps, make sure to set it back though!)

Problem

I want to import the file on the local machine using the "LOAD DATA LOCAL INPATH.." but, I can not import ``` $ beeline -u jdbc:hive2://example:10000 -e "LOAD DATA LOCAL INPATH 'tmp/file_20161024.dat' OVERWRITE INTO TABLE some_table PARTITION(dt=20161024);" Connecting to jdbc:hive2://example:10000 Connected to: Apache Hive (version 2.1.0) Driver: Hive JDBC (version 1.2.1) Transaction isolation: TRANSACTION_REPEATABLE_READ Error: Error while compiling statement: FAILED: SemanticException Line 1:23 Invalid path ''tmp/file_20161024.dat'': No files matching path file:/opt/hive/bin/tmp/file_20161024.dat (state=42000,code=40000) Closing: 0: jdbc:hive2://example:10000 ``` Perhaps, because the file was in local machine I think it was not imported. How can I use the local file as the import file I use beeline(1.2.1). There is Hiveserver on VirtualMachine(example). thanks! UPDATE I tried the following. ``` beeline -u jdbc:hive2://example:10000 -e "LOAD DATA LOCAL INPATH '/Users/asari/workspace/tmp/file_20161024.dat' OVERWRITE INTO TABLE some_table PARTITION(dt=20161024);" Connecting to jdbc:hive2://example:10000 Connected to: Apache Hive (version 2.1.0) Driver: Hive JDBC (version 1.2.1) Transaction isolation: TRANSACTION_REPEATABLE_READ Error: Error while compiling statement: FAILED: SemanticException Line 1:23 Invalid path ''/Users/asari/workspace/tmp/file_20161024.dat'': No files matching path file:/Users/asari/workspace/tmp/file_20161024.dat (state=42000,code=40000) Closing: 0: jdbc:hive2://example:10000 ```

Original source