hadoop - Error while adding UDF in hive -


i have add udf in hive. query trying :

create function strip1 'com.hadoopbook.hive.strip' using jar '/home/hduser/hadoop-tutorial/hadoop-book-master/ch17-hive/src/main/java/com/hadoopbook/hive/strip.jar' 

but getting exception :

failed: execution error, return code 1 org.apache.hadoop.hive.ql.exec.functiontask. hive warehouse non-local, /home/hduser/hadoop-tutorial/hadoop-book-master/ch17-hive/src/main/java/com/hadoopbook/hive/strip.jar specifies file on local filesystem. resources on non-local warehouse should specify non-local scheme/path

can tell how solve ?

three options:

  1. copy jar on hdfs , use path.

or

  1. as error telling you: in $hive_home/conf directory there hive-default.xml and/or hive-site.xml has hive.metastore.warehouse.dir property. add hdfs:/ path, , restart/re-run hive shell/script:

     <property>    <name>hive.metastore.warehouse.dir</name>    <value>hdfs://usr/hive/warehouse </value>    <description>location of warehouse directory</description>  </property> 

or

  1. if running hive queries hive shell then:

     hive> set hive.metastore.warehouse.dir;  hive.metastore.warehouse.dir=/user/hive/warehouse 

    above command prints path, prefix hdfs:/ below , re-run hive command(s) :

    hive> set hive.metastore.warehouse.dir="hdfs://user/hive/warehouse"; 

Comments