@Override public ObjectInspector initialize(ObjectInspector[] arg0) throws UDFArgumentException { if (arg0.length != 1 && arg0.length != 2) { throw new UDFArgumentException("estimated_reach takes an array of strings or an array of hashes, and an optional sketch size"); } if (arg0[0].getCategory() != Category.LIST) { throw new UDFArgumentException("estimated_reach takes an array of strings or an array of hashes, and an optional sketch size"); } this.listInspector = (ListObjectInspector) arg0[0]; if (listInspector.getListElementObjectInspector().getCategory() != Category.PRIMITIVE) { throw new UDFArgumentException("estimated_reach takes an array of strings or an array of hashes, and an optional sketch size"); } this.elemInspector = (PrimitiveObjectInspector) listInspector.getListElementObjectInspector(); LOG.info(" Element category is " + this.elemInspector.getCategory()); this.elemCategory = this.elemInspector.getPrimitiveCategory(); if (this.elemCategory != PrimitiveCategory.STRING && this.elemCategory != PrimitiveCategory.LONG) { throw new UDFArgumentException("estimated_reach takes an array of strings or an array of hashes, and an optional sketch size"); } if (arg0.length > 1) { if (!(arg0[1] instanceof IntObjectInspector)) { throw new UDFArgumentException("estimated_reach takes an array of strings or an array of hashes, and an optional sketch size"); } this.lengthInspector = (IntObjectInspector) arg0[1]; } return PrimitiveObjectInspectorFactory.javaLongObjectInspector; }