@Test public void testEvaluate() { ToTime udf = new ToTime(null); assertNull(udf.evaluate("2014-09-25 17:07:00")); assertNotNull(udf.evaluate("17:07:00")); assertNull(udf.evaluate("17:07:90")); assertNotNull(udf.evaluate("16:44:00")); }
public Time evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Time.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } }
ToTime extends UDF { public Time evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Time.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } }
ToTime extends UDF { public Time evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Time.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToTime(Map<String, String> config); }
ToTime extends UDF { public Time evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Time.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToTime(Map<String, String> config); Time evaluate(String s); }
ToTime extends UDF { public Time evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Time.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToTime(Map<String, String> config); Time evaluate(String s);  }