protected Object evaluateElement(Object current, Object next)
			throws UDFArgumentException {
    	if (next==null)
    		return current;
    	if (current == null)
    		return next;
		boolean greaterThan = false;
        switch (elementOI.getPrimitiveCategory()) {
          case INT: greaterThan = (((IntObjectInspector)elementOI).get(next) >
                                         ((IntObjectInspector)elementOI).get(current));
                                     break;
          case FLOAT: greaterThan = (((FloatObjectInspector)elementOI).get(next) >
                                         ((FloatObjectInspector)elementOI).get(current));
                                     break;
          case DOUBLE: greaterThan = (((DoubleObjectInspector)elementOI).get(next) >
                                         ((DoubleObjectInspector)elementOI).get(current));
                                    break;
          case LONG: greaterThan = (((LongObjectInspector)elementOI).get(next) >
                                         ((LongObjectInspector)elementOI).get(current));
                                      break;
          case SHORT: greaterThan = (((ShortObjectInspector)elementOI).get(next) >
                                         ((ShortObjectInspector)elementOI).get(current));
                                       break;
          default: throw new UDFArgumentException("Currently only int, float, double, long and short types are supported for this operation");
        }
        if (!greaterThan){
        	return next;
        }
        return current;
	}