Julian Hyde created CALCITE-1013: ------------------------------------ Summary: Annotate UDFs to indicate that their return is NOT NULL Key: CALCITE-1013 URL: https://issues.apache.org/jira/browse/CALCITE-1013 Project: Calcite Issue Type: Bug Reporter: Julian Hyde Assignee: Julian Hyde
If the return of a UDF is a Java object (i.e. not a primitive such as {{int}}) Calcite cannot tell whether the result is NOT NULL. To be safe, it must assume that it is nullable. If the function returns a date-time, the java.sql.Date, java.sql.Time or java.sql.Timestamp must be converted to a Integer, Integer or Long. This feature would add an annotation: {code}public static @AllowNulls(false) java.sql.Date myDateUdf(int x) { return new java.sql.Date(x); }{code} With the annotation, it would be safe to convert the return value to an int, int or long. The default is equivalent to specifying {{@AllowNulls(true)}}, except if the function returns a primitive (int, long, float etc.) -- This message was sent by Atlassian JIRA (v6.3.4#6332)