2014년 12월 31일 수요일

[cdh-user] Hive Default Path

I am a beginner in Hive (Hue). While loading a HDFS file in hive, I am providing the absolute hdfs path. However Hive is not detecting it ? Can some one please suggest, what is wrong, I tried adding files using the "add file" option in Hue as well. It did'nt work.




Correct me if I have understood your question correctly, you are having a problem in hive recognizing your default hdfs or even after you give the whole hdfs location it fails to add?

Through hive cli:
In hive you can add a file/jar below commands

 If want to add local file from current host from where hive cli was opened:
  hive>add file <localpath_of_file>;   #give full local path if its not your home directory where file exists
  hive>add file filename;  #If this file is present in your home location on local host from in which opened hive cli from directly

If you want to add hdfs file, then use below process
  hive>add file hdfs://<yourdefaultfs:8020>:/user/<exmp>/file1.txt   

before you add a file make sure you have the file by running 
hive>dfs -ls hdfs://<yourdefaultfs:8020>:/user/<exmp>/file1.txt (or) hadoop fs -ls hdfs://<yourdefaultfs:8020>:/user/<exmp>/file1.txt

***Using Hue, its pretty easy, go to hive beeswax and on left pane you have add resources option, select add file and browse through your hdfs path and add it. Keep me posted if you have any issues.



I guess I was not able to explain correctly, I am trying to load a HDFS file into Hive table. However I am getting the error as per screen print. My very basic question are
1. Is the data which I need to load into Hive table, should be with delimiters which were defined while creating the tables ?
2. What could be the reason hive is not able to pick the file from HDFS as per the attached screen shot ? 

mozilla.pdf



The foremost issue I'm seeing is you are not mentioning the default fs (file system) after hdfs: in your path. check your core-site.xml file and do mention your filesystem path after hdfs://. 
Hive doesn't take it automatically. for example path shoudl be like hdfs://<namenode.com:8020>:/user/cloudera/file_name.txt.

To get the correct patch of default fs , go to /usr/lib/hadoop/conf/core-site.xml and check default.fs.name property on namenode host. your path is incomplete so you are facing this issue. Thanks



Any Luck?



no man,, i got your point that I need to give full path, but till now has'nt worked out. I raised it with CDH support group


댓글 없음:

댓글 쓰기