Your UDF object will only initialized once per map or reducer. 
When you said your UDF object being initialized for each row, why do you think 
so? Do you have log to make you think that way?
If OK, please provide more information, so we can help you, like your example 
code, log etc....
Yong

Date: Tue, 25 Mar 2014 00:30:21 +0800
From: sky880883...@hotmail.com
To: user@hive.apache.org
Subject: Does hive instantiate new udf object for each record


Hi all,
        I'm trying to implement a udf which makes use of some data structures 
like binary tree.             However,  it seems that hive instantiates new udf 
object for each row in the table. Then the data structures would be also 
initialized again and again for each row.            Whereas, in the book 
<Programming Hive>, a geoip function is taken for an example showing that a 
LookupService object "is saved in a reference so it only needs to be 
initialized once in the lifetime of a map or reduce task that initializes it". 
The code for this function can be found here 
(https://github.com/edwardcapriolo/hive-geoip/).
        Could anyone give me some ideas how to make the udf object initialize 
once in the lifetime of a map or reduce task?
    
Best Regards,ypg


                                          

Reply via email to