@Test public void testEvaluate() { ToDouble toDouble = new ToDouble(null); ToDate toDate = new ToDate(null); ToTime toTime = new ToTime(null); ToTimeStamp toTimeStamp = new ToTimeStamp(null); ToDecimal toDecimal = new ToDecimal(null); assertTrue(toDouble.evaluate(1).equals(1.0D)); assertTrue(toDouble.evaluate(1F).equals(1.0D)); assertTrue(toDouble.evaluate(1.0f).equals(1.0D)); assertTrue(toDouble.evaluate(1.9d).equals(1.9D)); assertTrue(toDouble.evaluate("1").equals(1.0D)); assertTrue(toDouble.evaluate("1.9").equals(1.9D)); assertTrue(toDouble.evaluate(toDecimal.evaluate("1.9")).equals(1.9D)); assertTrue(toDouble.evaluate(toDate.evaluate("1970-01-01")).equals(-28800000.0D)); assertTrue(toDouble.evaluate(toTime.evaluate("15:40:00")).equals(27600000.0D)); assertTrue(toDouble.evaluate(toTimeStamp.evaluate("1970-01-01 15:40:00.000000")).equals(27600000.0D)); }
public Double evaluate(String s) { if (s == null) { return null; } try { return Double.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } }
ToDouble extends UDF { public Double evaluate(String s) { if (s == null) { return null; } try { return Double.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } }
ToDouble extends UDF { public Double evaluate(String s) { if (s == null) { return null; } try { return Double.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDouble(Map< String, String > config); }
ToDouble extends UDF { public Double evaluate(String s) { if (s == null) { return null; } try { return Double.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDouble(Map< String, String > config); Double evaluate(String s); Double evaluate(Long s); Double evaluate(Integer s); Double evaluate(Timestamp s); Double evaluate(BigDecimal s); Double evaluate(Date s); Double evaluate(Time s); Double evaluate(Double s); Double evaluate(Float s); }
ToDouble extends UDF { public Double evaluate(String s) { if (s == null) { return null; } try { return Double.valueOf(s); } catch (Exception e) { LOG.warn(EVALUATE_IGNORE_MESSAGE); return null; } } ToDouble(Map< String, String > config); Double evaluate(String s); Double evaluate(Long s); Double evaluate(Integer s); Double evaluate(Timestamp s); Double evaluate(BigDecimal s); Double evaluate(Date s); Double evaluate(Time s); Double evaluate(Double s); Double evaluate(Float s);  }