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