@Test public void testEvaluateFormatted() { ToDate udf = new ToDate(null); assertNotNull(udf.evaluate("2014-09-25 17:07:00", UDFConstants.TIMESTAMP_FORMAT)); assertNotNull(udf.evaluate("2014-09-25 17:07:01", UDFConstants.TIMESTAMP_FORMAT)); assertNotNull(new ToDate(null).evaluate("2014-09-25", UDFConstants.DATE_FORMAT)); }
public Date evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Date.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } }
ToDate extends UDF { public Date evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Date.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } }
ToDate extends UDF { public Date evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Date.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDate(Map<String, String> config); }
ToDate extends UDF { public Date evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Date.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDate(Map<String, String> config); Date evaluate(String s); Date evaluate(String s, String format); }
ToDate extends UDF { public Date evaluate(String s) { if (Strings.isNullOrEmpty(s)) { return null; } try { formatter.parse(s); return Date.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDate(Map<String, String> config); Date evaluate(String s); Date evaluate(String s, String format);  }