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