Returning None should result in that tuple being null, which is exactly what
you want when something is wrong but you don't want to break the entire process.
Alan.
On Sep 29, 2011, at 3:56 PM, Doug Daniels wrote:
> 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