throw new UDFArgumentException("Exactly two argument is expected.");
}
for(int i=0;i<arguments.length;i++){
if (arguments[i].getCategory() != ObjectInspector.Category.PRIMITIVE) {
throw new UDFArgumentTypeException(i,
"Only primitive type arguments are accepted but "
+ arguments[i].getTypeName() + " is passed.");
}
}
String t = arguments[1].getTypeName();
if (t.equals(Constants.TINYINT_TYPE_NAME)||
t.equals(Constants.SMALLINT_TYPE_NAME)||
t.equals(Constants.INT_TYPE_NAME)||
t.equals(Constants.BIGINT_TYPE_NAME)) {
resultOI = PrimitiveObjectInspectorFactory.writableLongObjectInspector;
} else if (t.equals(Constants.FLOAT_TYPE_NAME)||
t.equals(Constants.DOUBLE_TYPE_NAME)||
t.equals(Constants.STRING_TYPE_NAME)) {
resultOI = PrimitiveObjectInspectorFactory.writableDoubleObjectInspector;
} else{
throw new UDFArgumentTypeException(1,
"Only numeric or string type arguments are accepted but "
+ arguments[1].getTypeName() + " is passed.");
}
longResult.set(0);