1

I wrote a custom UDF in java and packed in a jar file. Then, I added it in Hive using:

create temporary function isstopword as 'org.dennis.udf.IsStopWord';

Every thing worked fine. But, after I updated a small part in the UDF, I did the previous steps again, consequently Hive obviously still used old version UDF.

How can I refresh the updated version of UDF?

I tried to deleted the old jar file in hdfs, and drop the udf function with:

DROP TEMPORARY FUNCTION IF EXISTS isstopword;

Then recreate a new function with the same name, it still used the older version UDF.

DennisLi
  • 3,915
  • 6
  • 30
  • 66

2 Answers2

1

I solved it by following this document:http://bdlabs.edureka.co/static/help/topics/cm_mc_hive_udf.html#concept_zb2_rxr_lw_unique_1

Generally with the following steps:

  1. added a config in hive-site.xml, then restart the hive server.
<property>
    <name>hive.reloadable.aux.jars.path</name>
    <value>/user/hive/udf</value>
</property>
  1. deleted the old jar file in HDFS, and upload the new jar file.

  2. DROP TEMPORARY FUNCTION IF EXISTS isstopword;

  3. in hive console, run list jar; to check the local jar files, it would print something like this:

/tmp/83ce8586-7311-4e97-813f-f2fbcec63a55_resources/isstopwordudf.jar

then delete them in your server file system.

  1. create a temp function again.
create temporary function isstopword as 'org.dennis.udf.IsStopWord';

With the above steps, it worked for me!

DennisLi
  • 3,915
  • 6
  • 30
  • 66
0

All the jars you add and the temporary functions you create are only specific to that particular hive session . Once you exit from that session all the temporary functions are lost forever .

Did you try closing the session and repeat the steps again .

sandy kay
  • 115
  • 1
  • 14