Adding Local Files in Beeline (Hive)

China☆狼群 提交于 2021-02-10 17:42:56

问题


I'm trying to add local files via the Beeline client, however I keep running into an issue where it tells me the file does not exist.

[test@test-001 tmp]$ touch /tmp/m.py
[test@test-001 tmp]$ stat /tmp/m.py 
  File: ‘/tmp/m.py’
  Size: 0           Blocks: 0          IO Block: 4096   regular empty file
Device: 801h/2049d  Inode: 34091464    Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1036/ test)   Gid: ( 1037/ test)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2017-02-27 22:04:06.527970709 +0000
Modify: 2017-02-27 22:04:06.527970709 +0000
Change: 2017-02-27 22:04:06.527970709 +0000
 Birth: -
[test@test-001 tmp]$ beeline -u jdbc:hive2://hs2-test:10000/default -n r-zubis
Connecting to jdbc:hive2://hs2-test:10000/default
Connected to: Apache Hive (version 1.2.1.2.3.0.0-2557)
Driver: Hive JDBC (version 1.2.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Beeline version 1.2.1 by Apache Hive
0: jdbc:hive2://hs2-test:10000/def> ADD FILE '/tmp/m.py';
Error: Error while processing statement: '/tmp/m.py' does not exist (state=,code=1)
0: jdbc:hive2://hs2-test:10000/def> 

What's the issue?


回答1:


You can only add files on the box HiveServer2 is running on. (and I needed to remove the quotes) I found it via a blog comment on Cloudera. Not sure why this isn't in the Beeline docs.




回答2:


If, like me you are stuck in the position where HiveServer2 is running remotely, beeline will let you load the files from HDFS,

hdfs fs -put /tmp/m.py

then

beeline> add file hdfs:/user/homedir/m.py;


来源:https://stackoverflow.com/questions/42496672/adding-local-files-in-beeline-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!