----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30472/#review70879 -----------------------------------------------------------
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java <https://reviews.apache.org/r/30472/#comment116327> How about char/varchar type as well? You can do something like PrimitiveGrouping.getPrimitiveGrouping(inputType2) == PrimitiveGrouping.STRING_GROUP to check here. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java <https://reviews.apache.org/r/30472/#comment116336> Hive UDFs have traditionally taken the behavior that bad input during query execution usually results in returning NULL value, rather than throwing an exception and killing the entire job/query. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java <https://reviews.apache.org/r/30472/#comment116330> An enum with fields could make this a little less verbose: MONDAY(Calendar.MONDAY, "MONDAY", "MON", "MO"), TUESDAY(.... You could then use a loop to check each day. Anyway, not a necessary fix, this does get the job done. ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java <https://reviews.apache.org/r/30472/#comment116347> same here regarding returning null vs throwing exception - Jason Dere On Feb. 2, 2015, 11:33 p.m., Alexander Pivovarov wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/30472/ > ----------------------------------------------------------- > > (Updated Feb. 2, 2015, 11:33 p.m.) > > > Review request for hive, Jason Dere and Thejas Nair. > > > Bugs: HIVE-9520 > https://issues.apache.org/jira/browse/HIVE-9520 > > > Repository: hive-git > > > Description > ------- > > Example > select next_day('2015-02-02','Fri') ...; > OK > 2015-02-06 > > > Diffs > ----- > > ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java > 23d77ca4cc2e2a44b62f62ddbd4826df092bcfe8 > ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFNextDay.java > PRE-CREATION > > ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFNextDay.java > PRE-CREATION > ql/src/test/queries/clientnegative/udf_next_day_error_1.q PRE-CREATION > ql/src/test/queries/clientnegative/udf_next_day_error_2.q PRE-CREATION > ql/src/test/queries/clientnegative/udf_next_day_error_3.q PRE-CREATION > ql/src/test/queries/clientpositive/udf_next_day.q PRE-CREATION > ql/src/test/results/clientnegative/udf_next_day_error_1.q.out PRE-CREATION > ql/src/test/results/clientnegative/udf_next_day_error_2.q.out PRE-CREATION > ql/src/test/results/clientnegative/udf_next_day_error_3.q.out PRE-CREATION > ql/src/test/results/clientpositive/show_functions.q.out > 36c8743a61c55a714352d358a5d9cc0deb4cef2c > ql/src/test/results/clientpositive/udf_next_day.q.out PRE-CREATION > > Diff: https://reviews.apache.org/r/30472/diff/ > > > Testing > ------- > > > Thanks, > > Alexander Pivovarov > >