The default behavior of Drill UDFs is NullHandling.NULL_IF_NULL semantics. This means that a the Drill engine manages checking nullability on inputs. If one or more inputs is null, then the output is null. You can also implement NullHandling.INTERNAL as your null semantics in a UDF. This allows you to set nullability on your output independent of the nullability of the inputs. An example is the isNull functions [1]. Note that the complexity with using internal handling if you have to create implementations for all variations of null inputs and outputs. This is the cartesian product of variations when you have multiple parameters. As such, we generally use freemarker templates (per the example below) to create the variations.
[1] https://github.com/apache/drill/blob/master/exec/java-exec/src/main/codegen/templates/NullOperator.java -- Jacques Nadeau CTO and Co-Founder, Dremio On Mon, Jan 4, 2016 at 8:04 PM, Nirav Shah <[email protected]> wrote: > Hi, > May be this is silly question, Please let me know how to return null string > from drill custom function. > > > Regards, > Nirav >
