@Override
	public ObjectInspector initialize(ObjectInspector[] arguments)
			throws UDFArgumentException {
       if (arguments.length != 1) {
	        throw new UDFArgumentTypeException(arguments.length-1,
	            "One arguments are required");
	      }
		
		
		
		
		ObjectInspector returnObjectInspector = PrimitiveObjectInspectorFactory.writableIntObjectInspector;
		if (arguments[0].getCategory() != ObjectInspector.Category.LIST) {
				 throw new UDFArgumentTypeException(0,
				            "The argument of function should be a list of primatives, but \""
				            + arguments[0].getTypeName() + "\" is found");
				}else {
					ListObjectInspector loi = (ListObjectInspector)arguments[0];
					if (loi.getListElementObjectInspector().getCategory() != ObjectInspector.Category.PRIMITIVE) {
						throw new UDFArgumentTypeException(0,
					            "The argument of function should be a list of primatives, but \""
					            + arguments[0].getTypeName() + "\" is found");
					}else{
						
					listOI = loi;
					elementOI = (PrimitiveObjectInspector) loi.getListElementObjectInspector();
			        switch (elementOI.getPrimitiveCategory()) {
			          case INT: returnObjectInspector = PrimitiveObjectInspectorFactory.writableIntObjectInspector;
			                                     break;
			          case FLOAT: returnObjectInspector = PrimitiveObjectInspectorFactory.writableFloatObjectInspector;
			                                     break;
			          case DOUBLE: returnObjectInspector = PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
			                                    break;
			          case LONG: returnObjectInspector = PrimitiveObjectInspectorFactory.writableLongObjectInspector;
			                                      break;
			          case SHORT: returnObjectInspector = PrimitiveObjectInspectorFactory.writableShortObjectInspector;
			                                       break;
			          default: throw new UDFArgumentException("Currently only int, float, double, long and short types are supported for this operation");
			        }
						returnObjectInspector = PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector(
								((PrimitiveObjectInspector)loi.getListElementObjectInspector()).getPrimitiveCategory());
					}

				}

	        
	    
	    return returnObjectInspector;
	}