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

Switch to Threaded View
Pig >> mail # user >> python UDF that returns None


Copy link to this message
-
python UDF that returns None
I'm writing a python UDF that returns a tuple with three fields.  I'm wondering if it's ok to return None if for some reason I can't build the tuple, but don't want to throw an Exception and stop processing.

For example, on a much-simplified version of the UDF:

@outputSchema('t:tuple(a:int, b:int, c:int)')
def get_tpl(input):
    if input < 5:
        return (1, 2, 3)
    else:
        return None;

Should I be returning None or (None,  None, None).  Also, will there be any type issues if I return None back instead of a int?

Thanks,
Doug