1

A UDF used some external resource files, then it error: "java.io.FileNotFoundException: resource/placeMap.txt (No such file or directory)", this function runs right at native, why wrong at hive, how can I solved it ? Thank you very much!

Suge
  • 2,808
  • 3
  • 48
  • 79

2 Answers2

2

look at this. what you want to do is add file <filename> so that <filename> can be added to distributed cache.

it will be accessible as if in the same path as the executable/jar, so check your relatives paths as well.

Rohan Monga
  • 1,759
  • 1
  • 19
  • 31
1

what hive basicly does is convert your queries to hadoop map-reduce jobs. so they are executed on the machines that have task trackers. so if you are using an external source you eighter need to be sure that that file exists in every single machine at exact same path (and it would be much better to use fullpath) or get the file from hdfs, and load the source file from hdfs. (I prefer using hdfs, much safer that way)

frail
  • 4,123
  • 2
  • 30
  • 38
  • I believe hive has an add resource command that should help with the external files distribution. I have not used it. – cftarnas Sep 07 '11 at 02:10