?There might be a few cases where a UDF is executed locally and not as part of 
a Map/Reduce job?:

 - Hive might choose not to run a M/R task for your query (see 
hive.fetch.task.conversion)

 - If the UDF is deterministic and has deterministic inputs, Hive might decide 
to run the UDF once to get the value and use constant folding to replace calls 
of that UDF with the value from the one UDF call (see 
hive.optimize.constant.propagation?)


Taking a look at the explain plan for you query might confirm this. In those 
cases the UDF would not run within a M/R task and configure() would not be 
called.



________________________________
From: Rahul Sharma <kippy....@gmail.com>
Sent: Tuesday, August 25, 2015 11:32 AM
To: user@hive.apache.org
Subject: UDF Configure method not getting called

Hi Guys,

We have a UDF which extends GenericUDF and does some configuration within the 
public void configure(MapredContext ctx) method.

MapredContext in configure method gives access to the HiveConfiguration via 
JobConf, which contains custom attributes of the form xy.abc.something. Reading 
these values is required for the semantics of the UDF.

Everything works fine till Hive 0.13, however with Hive 0.14 (or 1.0) the 
configure method of the UDF is never called by the runtime and hence the UDF 
cannot configure itself dynamically.

Is this the intended behavior? If so, what is the new way to read configuration 
of the Map Reduce Job within the UDF?

I would be grateful for any help.

Reply via email to