@Test public void testUDF() throws IOException { IntegerFirstNotEmpty udf = new IntegerFirstNotEmpty(); TupleFactory factory = TupleFactory.getInstance(); assertNull(udf.exec(null)); assertNull(udf.exec(factory.newTuple())); assertNull(udf.exec(factory.newTuple((Integer) null))); assertEquals(125, (int)udf.exec(factory.newTuple(Integer.valueOf(125)))); assertNull(udf.exec(factory.newTuple(Lists.newArrayList()))); assertNull(udf.exec(factory.newTuple(Lists.newArrayList(null, null)))); assertEquals(23, (int)udf.exec(factory.newTuple(Lists.newArrayList(23, null, 256, 90)))); assertEquals(256, (int)udf.exec(factory.newTuple(Lists.newArrayList(null, null, null, 256, 567)))); }
@Override public Integer exec(Tuple tuple) throws IOException { if (tuple == null) { return null; } for (int i = 0; i < tuple.size(); i++) { Integer ret = (Integer) tuple.get(i); if (ret != null) { return ret; } } return null; }
IntegerFirstNotEmpty extends EvalFunc<Integer> { @Override public Integer exec(Tuple tuple) throws IOException { if (tuple == null) { return null; } for (int i = 0; i < tuple.size(); i++) { Integer ret = (Integer) tuple.get(i); if (ret != null) { return ret; } } return null; } }
IntegerFirstNotEmpty extends EvalFunc<Integer> { @Override public Integer exec(Tuple tuple) throws IOException { if (tuple == null) { return null; } for (int i = 0; i < tuple.size(); i++) { Integer ret = (Integer) tuple.get(i); if (ret != null) { return ret; } } return null; }  }
IntegerFirstNotEmpty extends EvalFunc<Integer> { @Override public Integer exec(Tuple tuple) throws IOException { if (tuple == null) { return null; } for (int i = 0; i < tuple.size(); i++) { Integer ret = (Integer) tuple.get(i); if (ret != null) { return ret; } } return null; }  @Override Integer exec(Tuple tuple); }
IntegerFirstNotEmpty extends EvalFunc<Integer> { @Override public Integer exec(Tuple tuple) throws IOException { if (tuple == null) { return null; } for (int i = 0; i < tuple.size(); i++) { Integer ret = (Integer) tuple.get(i); if (ret != null) { return ret; } } return null; }  @Override Integer exec(Tuple tuple);  }