@Override public String getDisplayString(String[] children) { return getStandardDisplayString(getFuncName(), children); }
@Override public String getDisplayString(String[] children) { return getStandardDisplayString(getFuncName(), children); }
protected void checkIfPrimitive(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { ObjectInspector.Category oiCat = arguments[i].getCategory(); if (oiCat != ObjectInspector.Category.PRIMITIVE) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes primitive types as " + argOrder + " argument, got " + oiCat); } }
protected void checkIfPrimitive(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { ObjectInspector.Category oiCat = arguments[i].getCategory(); if (oiCat != ObjectInspector.Category.PRIMITIVE) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes primitive types as " + argOrder + " argument, got " + oiCat); } }
@Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 1) { throw new UDFArgumentLengthException(getFuncName() + " requires 1 argument, got " + arguments.length); } checkIfPrimitive(arguments, 0, "1st"); checkIfStringGroup(arguments, 0, "1st"); getStringConverter(arguments, 0, "1st"); ObjectInspector outputOI = PrimitiveObjectInspectorFactory.writableStringObjectInspector; return outputOI; }
protected void checkIfStringGroup(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { inputTypes[i] = ((PrimitiveObjectInspector) arguments[i]).getPrimitiveCategory(); if (PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.STRING_GROUP && PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.VOID_GROUP) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes STRING_GROUP types as " + argOrder + " argument, got " + inputTypes[i]); } }
protected void checkIfStringGroup(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { inputTypes[i] = ((PrimitiveObjectInspector) arguments[i]).getPrimitiveCategory(); if (PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.STRING_GROUP && PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.VOID_GROUP) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes STRING_GROUP types as " + argOrder + " argument, got " + inputTypes[i]); } }
@Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 1) { throw new UDFArgumentLengthException(getFuncName() + " requires 1 argument, got " + arguments.length); } checkIfPrimitive(arguments, 0, "1st"); checkIfStringGroup(arguments, 0, "1st"); getStringConverter(arguments, 0, "1st"); ObjectInspector outputOI = PrimitiveObjectInspectorFactory.writableStringObjectInspector; return outputOI; }
@Override public String getDisplayString(String[] children) { return getStandardDisplayString(getFuncName(), children); }
protected void checkIfPrimitive(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { ObjectInspector.Category oiCat = arguments[i].getCategory(); if (oiCat != ObjectInspector.Category.PRIMITIVE) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes primitive types as " + argOrder + " argument, got " + oiCat); } }
@Override public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentException { if (arguments.length != 1) { throw new UDFArgumentLengthException(getFuncName() + " requires 1 argument, got " + arguments.length); } checkIfPrimitive(arguments, 0, "1st"); checkIfStringGroup(arguments, 0, "1st"); getStringConverter(arguments, 0, "1st"); ObjectInspector outputOI = PrimitiveObjectInspectorFactory.writableStringObjectInspector; return outputOI; }
protected void checkIfStringGroup(ObjectInspector[] arguments, int i, String argOrder) throws UDFArgumentTypeException { inputTypes[i] = ((PrimitiveObjectInspector) arguments[i]).getPrimitiveCategory(); if (PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.STRING_GROUP && PrimitiveObjectInspectorUtils.getPrimitiveGrouping(inputTypes[i]) != PrimitiveGrouping.VOID_GROUP) { throw new UDFArgumentTypeException(i, getFuncName() + " only takes STRING_GROUP types as " + argOrder + " argument, got " + inputTypes[i]); } }