Hello,
I've encountered a strange error when using NULL in a number of ways. I
would expect to_date(NULL) to just return NULL. However, when the NULL
is cast to a timestamp, this works fine. Should this case be handled by
the to_date UDF? What about other UDFs that may need to handle NULL
literals with the VOID type?
hive> select to_date(NULL);
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments
'TOK_NULL': TO_DATE() only takes STRING/TIMESTAMP/DATEWRITABLE types,
got VOID
hive> select to_date(cast(NULL as timestamp));
OK
NULL
Time taken: 0.288 seconds, Fetched: 1 row(s)
This appears to be thrown in this method:
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFDate.java#L64
Thanks,
Aaron Tokhy