0

I created a UDF and exported the jar as abc.jar.

Copied the jar in hdfs at /user/hive/warehouse.

Now, I am getting below errors:

hive> ADD JAR /user/hive/warehouse/abc.jar;
/user/hive/warehouse/abc.jar does not exist
Query returned non-zero code: 1, cause: /user/hive/warehouse/abc.jar does not exist.
hive> 

When I do, hadoop fs -ls /user/hive, I can see abc.jar at /user/hive/warehouse path.

Where am I doing wrong and what is the solution for this?

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101
earl
  • 738
  • 1
  • 17
  • 38
  • Place your UDF jar on the local file system of the hive client machine and give the absolute local path of the jar in the ADD JAR command – Nitin Kumar Apr 28 '16 at 08:43

3 Answers3

1

When you add jar from hdfs you use the following statement :

ADD jar hdfs://namenode/user/hive/warehouse/abc.jar;

you are not notifying that you are adding the jar from hdfs . That is the cause of your error.

Hope that helps

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101
Bijoy
  • 113
  • 7
1

The way, you are mentioning the path, it will look the file in local file system.
Either place it there, or use hdfs:// like this

hive> ADD JAR /user/hive/warehouse/abc.jar   => local filesystem
hive> ADD JAR hdfs://namenodei/user/hive/warehouse/abc.jar   => In hdfs
Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101
0

Above options are valid for current sessions only. So every time you need to write ADD JAR. In order to add it permanently recommended ways are as follows.

  1. add in hive-site.xml

    <property> <name>hive.aux.jars.path</name> <value>file://localpath/yourjar.jar</value> </property>

  2. Copy and paste the JAR file to the ${HIVE_HOME}/auxlib/ folder

Dhruv Kapatel
  • 873
  • 3
  • 14
  • 27