Yes.

Are you looking for a way to share info across multiple instances of the UDF? You can share static information via UDFContext. If you want to share state while running that is very difficult and not recommended (since there is no guarantee that your various map or reduce instances will be running simultaneously).

Alan.

On Mar 17, 2011, at 11:37 AM, souri datta wrote:

so if i make the list static also, it will be created multiple times as each
instance will be created in different machine's JVM .
is that correct?


On Thu, Mar 17, 2011 at 11:59 PM, Alan Gates <[email protected]> wrote:

It will be instantiated multiple times; once for each map or reduce
(depending on which it is in). Pig itself also constructs your UDF during
planning on the machine you launch your job on.

Alan.


On Mar 17, 2011, at 11:12 AM, souri datta wrote:

Hi,
If in a UDF , say in the constructor of the class, i initialize a list
(say  ArrayList<String> namesList) of objects(say names). And in the
exec()
method , I do some processing. When I am using this udf in a 20 node
hadoop
cluster, will this list 'nameList' be instantiated multiple times or will their be a single instance of namesList and all the mapper/ reducers will
use
this single one?

Thanks,
Souri




Reply via email to