@Test public void testEvaluate() { System.out.println("Integer max value : " + Integer.MAX_VALUE + ", Integer min value " + Integer.MIN_VALUE); Abs abs = new Abs(null); assertTrue(abs.evaluate(1).equals(1)); assertTrue(abs.evaluate(-1).equals(1)); assertTrue(abs.evaluate(0).equals(0)); assertTrue(abs.evaluate(-0).equals(0)); assertTrue(abs.evaluate(Integer.MAX_VALUE).equals(Integer.MAX_VALUE)); assertTrue(abs.evaluate(Integer.MIN_VALUE).equals(Integer.MIN_VALUE)); System.out.println("Long max value : " + Long.MAX_VALUE + ", Long min value " + Long.MIN_VALUE); assertTrue(abs.evaluate(1L).equals(1L)); assertTrue(abs.evaluate(-1L).equals(1L)); assertTrue(abs.evaluate(0L).equals(0L)); assertTrue(abs.evaluate(-0L).equals(0L)); assertTrue(abs.evaluate(Long.MAX_VALUE).equals(Long.MAX_VALUE)); assertTrue(abs.evaluate(Long.MIN_VALUE).equals(Long.MIN_VALUE)); assertTrue(abs.evaluate(1.0f).equals(1.0f)); assertTrue(abs.evaluate(-1.0f).equals(1.0f)); assertTrue(abs.evaluate(0.0f).equals(0.0f)); assertTrue(abs.evaluate(-0.0f).equals(0.0f)); assertTrue(abs.evaluate(1.0d).equals(1.0d)); assertTrue(abs.evaluate(-1.0d).equals(1.0d)); assertTrue(abs.evaluate(0.0d).equals(0.0d)); assertTrue(abs.evaluate(-0.0d).equals(0.0d)); assertTrue(abs.evaluate(new BigDecimal("1.0")).intValue() == 1); assertTrue(abs.evaluate(new BigDecimal("-1.0")).intValue() == 1); assertTrue(abs.evaluate(new BigDecimal("0.0")).intValue() == 0); assertTrue(abs.evaluate(new BigDecimal("-0.0")).intValue() == 0); }
public Integer evaluate(Integer number) { if (number == null) { return null; } return Math.abs(number); }
Abs extends UDF { public Integer evaluate(Integer number) { if (number == null) { return null; } return Math.abs(number); } }
Abs extends UDF { public Integer evaluate(Integer number) { if (number == null) { return null; } return Math.abs(number); } Abs(Map<String, String> config); }
Abs extends UDF { public Integer evaluate(Integer number) { if (number == null) { return null; } return Math.abs(number); } Abs(Map<String, String> config); Integer evaluate(Integer number); Long evaluate(Long number); Float evaluate(Float number); Double evaluate(Double number); BigDecimal evaluate(BigDecimal number); }
Abs extends UDF { public Integer evaluate(Integer number) { if (number == null) { return null; } return Math.abs(number); } Abs(Map<String, String> config); Integer evaluate(Integer number); Long evaluate(Long number); Float evaluate(Float number); Double evaluate(Double number); BigDecimal evaluate(BigDecimal number);  }