Doris 用hive UDF函数jar 注册成Doris 函数提示 Multi methods 'evaluate' in class 'com.xxx.xxx' and no one passed parameter matching verification

Viewed 18

直接将已经在hive 注册成功的jar,在doris 中注册成本地函数。
1、hive UDF函数伪代码

public class hiveFunction extends GenericUDF {
    @Override
    public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumentLengthException {
        if (arguments != null) {
            if (arguments.length != 1) {
                throw new UDFArgumentLengthException("SRM Decrypt Function only support one argument!");
            }
        }
        return PrimitiveObjectInspectorFactory.javaStringObjectInspector;
    }

    @Override
    public String evaluate(DeferredObject[] arguments) throws HiveException {

        //业务逻辑
    }

    @Override
    public String getDisplayString(String[] children) {
        return null;
    }
}

2、注册本地函数

CREATE FUNCTION udftest(String) RETURNS String PROPERTIES (
    "file"="file:///opt/app/apache-doris-bin-x64-noavx2/custom-functions/hive-udf-xxx.jar",
    "symbol"="com.xxx.xxx",
    "always_nullable"="true",
    "type"="JAVA_UDF"
);

3、错误信息

errCode = 2, detailMessage = Multi methods 'evaluate' in class 'com.sunwoda.SrmTenderPriceDecrypt' and no one passed parameter matching verification
1 Answers

这里应该是 evaluate 中的输入参数类型的问题,目前Doris还不支持这种类型,看看换下输入参数类型试试的。