Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig, mail # user - UDFContext() for a UDF


Copy link to this message
-
UDFContext() for a UDF
Raghu Angadi 2011-06-27, 21:16
UDF I am trying to implement:
  - output schema is same as input schema.
  - if (input == null)
        return tuple matching the schema with NULL for each field.
    else return input.

For this, the UDF needs to pass number for fields in input schema to
backend. LoadFunc and StoreFunc handle such a case through setting
properties in UDFContext.getUDFContext().getUDFProperties(class, *
contextSignature)*.
But there does not seem to be any context signature for UDFs.

Is there a way implement such UDF?

Once option is to ask the user to provide number of fields as an argument to
UDF constructor, but that is pretty error prone and practical only in very
simple cases.

UDFContext seems to contain context only for storage.

thanks,
Raghu.