default: throw new UDFArgumentTypeException(0, "Element[s] of first argument array in function SORT_ARRAY_BY must be " + serdeConstants.STRUCT_TYPE_NAME + ", but " + listObjectInspector.getTypeName() + " was found.");
default: throw new UDFArgumentTypeException(0, "Element[s] of first argument array in function SORT_ARRAY_BY must be " + serdeConstants.STRUCT_TYPE_NAME + ", but " + listObjectInspector.getTypeName() + " was found.");
@Override public ObjectInspector initialize(ObjectInspector[] arg0) throws UDFArgumentException { if (arg0.length < 2) { throw new UDFArgumentException(" Expecting at least two arrays as arguments "); } ObjectInspector first = arg0[0]; listInspectorArr = new ListObjectInspector[arg0.length]; if (first.getCategory() == Category.LIST) { listInspectorArr[0] = (ListObjectInspector) first; } else { throw new UDFArgumentException(" Expecting an array as first argument "); } for (int i = 1; i < arg0.length; ++i) { if (arg0[i].getCategory() != Category.LIST) { throw new UDFArgumentException(" Expecting arrays arguments "); } ListObjectInspector checkInspector = (ListObjectInspector) arg0[i]; if (!ObjectInspectorUtils.compareTypes(listInspectorArr[0].getListElementObjectInspector(), checkInspector.getListElementObjectInspector())) { throw new UDFArgumentException(" Array types must match " + listInspectorArr[0].getTypeName() + " != " + checkInspector.getTypeName()); } listInspectorArr[i] = checkInspector; } retValInspector = (StandardListObjectInspector) ObjectInspectorUtils.getStandardObjectInspector(first); return retValInspector; }
@Override public ObjectInspector initialize(ObjectInspector[] arg0) throws UDFArgumentException { if (arg0.length < 2) { throw new UDFArgumentException(" Expecting at least two arrays as arguments "); } ObjectInspector first = arg0[0]; listInspectorArr = new ListObjectInspector[arg0.length]; if (first.getCategory() == Category.LIST) { listInspectorArr[0] = (ListObjectInspector) first; } else { throw new UDFArgumentException(" Expecting an array as first argument "); } for (int i = 1; i < arg0.length; ++i) { if (arg0[i].getCategory() != Category.LIST) { throw new UDFArgumentException(" Expecting arrays arguments "); } ListObjectInspector checkInspector = (ListObjectInspector) arg0[i]; if (!ObjectInspectorUtils.compareTypes(listInspectorArr[0].getListElementObjectInspector(), checkInspector.getListElementObjectInspector())) { throw new UDFArgumentException(" Array types must match " + listInspectorArr[0].getTypeName() + " != " + checkInspector.getTypeName()); } listInspectorArr[i] = checkInspector; } retValInspector = (StandardListObjectInspector) ObjectInspectorUtils.getStandardObjectInspector(first); return retValInspector; }
LOG.info(" Key list has key type " + keyListInspector.getTypeName()); if (((PrimitiveObjectInspector) keyListInspector.getListElementObjectInspector()).getPrimitiveCategory() != ((PrimitiveObjectInspector) mapKeyInspector).getPrimitiveCategory()) { throw new UDFArgumentException(" Expecting keys to be of same types.");
throw new UDFArgumentException( "_FUNC_ takes double[] or string[] for the first argument: " + listOI.getTypeName());
throw new UDFArgumentException( "_FUNC_ takes double[] or string[] for the first argument: " + listOI.getTypeName());
throw new UDFArgumentException( "_FUNC_ takes double[] or string[] for the first argument: " + listOI.getTypeName());
@Override public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException { if (argOIs.length < 2) { throw new UDFArgumentException("Expecting at least two arrays as arguments"); } ListObjectInspector[] listOIs = new ListObjectInspector[argOIs.length]; ListObjectInspector arg0OI = HiveUtils.asListOI(argOIs[0]); listOIs[0] = arg0OI; ObjectInspector arg0ElemOI = arg0OI.getListElementObjectInspector(); for (int i = 1; i < argOIs.length; ++i) { ListObjectInspector checkOI = HiveUtils.asListOI(argOIs[i]); if (!ObjectInspectorUtils.compareTypes(arg0ElemOI, checkOI.getListElementObjectInspector())) { throw new UDFArgumentException("Array types does not match: " + arg0OI.getTypeName() + " != " + checkOI.getTypeName()); } listOIs[i] = checkOI; } this._listOIs = listOIs; return ObjectInspectorFactory.getStandardListObjectInspector( ObjectInspectorUtils.getStandardObjectInspector(arg0ElemOI, ObjectInspectorCopyOption.WRITABLE)); }
@Override public ObjectInspector initialize(ObjectInspector[] argOIs) throws UDFArgumentException { final int argLen = argOIs.length; if (argLen < 2 || argLen > 4) { throw new UDFArgumentException("_FUNC_ takes 2~4 arguments: " + argLen); } this.modelOI = HiveUtils.asStringOI(argOIs[0]); String options = HiveUtils.getConstString(argOIs[1]); processOptions(options); if (argLen >= 3) { this.featureNamesOI = HiveUtils.asListOI(argOIs[2]); if (!HiveUtils.isStringOI(featureNamesOI.getListElementObjectInspector())) { throw new UDFArgumentException("_FUNC_ expected array<string> for featureNames: " + featureNamesOI.getTypeName()); } if (argLen == 4) { this.classNamesOI = HiveUtils.asListOI(argOIs[3]); if (!HiveUtils.isStringOI(classNamesOI.getListElementObjectInspector())) { throw new UDFArgumentException("_FUNC_ expected array<string> for classNames: " + classNamesOI.getTypeName()); } } } return PrimitiveObjectInspectorFactory.writableStringObjectInspector; }
throw new UDFArgumentException( "tree_predict takes array<double> or array<string> for the second argument: " + listOI.getTypeName());