Buggy code:
@ Description ( name = "query_dt" , value = "_FUNC_([dt_diff[,<seq2seq4repair_space>delimiter]])<seq2seq4repair_space>-<seq2seq4repair_space>Returns<seq2seq4repair_space>the<seq2seq4repair_space>date<seq2seq4repair_space>when<seq2seq4repair_space>the<seq2seq4repair_space>query<seq2seq4repair_space>was<seq2seq4repair_space>submitted.\n" + ( ( ( ( "e.g.,<seq2seq4repair_space>if<seq2seq4repair_space>the<seq2seq4repair_space>query<seq2seq4repair_space>was<seq2seq4repair_space>submitted<seq2seq4repair_space>on<seq2seq4repair_space>2014//01//23,<seq2seq4repair_space>then\n" + "query_dt()<seq2seq4repair_space>=><seq2seq4repair_space>\'20140123\'\n" ) + "query_dt(-1)<seq2seq4repair_space>=><seq2seq4repair_space>\'20140122\'\n" ) + "query_dt(\'-\')<seq2seq4repair_space>=><seq2seq4repair_space>\'2014-01-23\'\n" ) + "query_dt(3,<seq2seq4repair_space>'-')<seq2seq4repair_space>=><seq2seq4repair_space>'2014-01-26'" ) ) public class GenericUDFQueryDate extends GenericUDF { static final Log LOG = LogFactory . getLog ( GenericUDFQueryDate . class . getName ( ) ) ; private transient WritableIntObjectInspector dtDiffOi ; private transient WritableStringObjectInspector delimiterOi ; private final transient IntWritable DefaultDtDiff = new IntWritable ( 0 ) ; private final transient Text DefaultDelimiter = new Text ( "" ) ; private transient Table < Text , IntWritable , Text > cached = HashBasedTable . create ( ) ; private final transient Long initTimeStamp = System . currentTimeMillis ( ) ; public static final transient long DAY_MILLISECONDS = ( 24L * 3600 ) * 1000 ; @ Override public ObjectInspector initialize ( ObjectInspector [ ] arguments ) throws UDFArgumentException { } protected void initializeInput ( ObjectInspector [ ] arguments ) throws UDFArgumentException { if ( ( arguments . length ) > 2 ) { throw new UDFArgumentLengthException ( ( "The<seq2seq4repair_space>function<seq2seq4repair_space>TO_UNIX_TIMESTAMP<seq2seq4repair_space>" + "requires<seq2seq4repair_space>no<seq2seq4repair_space>more<seq2seq4repair_space>thant<seq2seq4repair_space>2<seq2seq4repair_space>argument" ) ) ; } int nextArgument = 0 ; if ( ( arguments . length ) > 0 ) { if ( ( arguments [ nextArgument ] ) instanceof WritableIntObjectInspector ) { dtDiffOi = ( ( WritableIntObjectInspector ) ( arguments [ 0 ] ) ) ; nextArgument ++ ; } <START_BUG> if ( ( ( arguments . length ) > 1 ) && ( ( arguments [ nextArgument ] ) instanceof WritableStringObjectInspector ) ) { <END_BUG> delimiterOi = ( ( WritableStringObjectInspector ) ( arguments [ nextArgument ] ) ) ; nextArgument ++ ; } } if ( nextArgument < ( arguments . length ) ) { throw new UDFArgumentException ( ( ( "The<seq2seq4repair_space>function<seq2seq4repair_space>" + ( getName ( ) . toUpperCase ( ) ) ) + "<seq2seq4repair_space>takes<seq2seq4repair_space>only<seq2seq4repair_space>string<seq2seq4repair_space>or<seq2seq4repair_space>int<seq2seq4repair_space>parameter" ) ) ; } } protected String getName ( ) { } private String calculate ( String delim , int diff ) { } private Text cacheGet ( Text delim ) { } private Text cacheGet ( IntWritable diff ) { } private Text cacheGet ( Text delim , IntWritable diff ) { } @ Override public Object evaluate ( DeferredObject [ ] arguments ) throws HiveException { } @ Override public String getDisplayString ( String [ ] children ) { } No newline ; at end ; of file ; }

Fix:
if ( ( nextArgument < ( arguments . length ) ) && ( ( arguments [ nextArgument ] ) instanceof WritableStringObjectInspector ) ) {