atom feed1 message in org.apache.hadoop.pig-userUDFContext() for a UDF
FromSent OnAttachments
Raghu AngadiJun 27, 2011 2:15 pm 
Subject:UDFContext() for a UDF
From:Raghu Angadi (rang@apache.org)
Date:Jun 27, 2011 2:15:31 pm
List:org.apache.hadoop.pig-user

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.