3

我想使用“LOAD DATA LOCAL INPATH..”在本地机器上导入文件

但是,我无法导入

$ 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

也许,因为文件在本地机器上,我认为它没有被导入。

如何使用本地文件作为导入文件

我使用直线(1.2.1)。

VirtualMachine 上有 Hiveserver(示例)。

谢谢!

更新

我尝试了以下。

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
4

1 回答 1

3

只是猜测,但根据您的描述,我会说您指向错误的位置。

大概你有一个“普通”本地目录中的文件。在这种情况下,您可能需要像以下两个示例之一那样引用它:

/tmp/file_20161024.dat

/home/asari/tmp/file_20161024.dat

注意开头/


如果您的文件实际上位于您现在尝试的位置

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

然后请检查该文件是否有任何行,以及访问该文件的权限。(如果您不确定需要哪些权限,请将权限设置为完全开放,看看这是否有帮助,但请务必将其设置回来!)

于 2016-10-27T07:12:39.690 回答