public class UDF extends Object implements ContextFunction
自定义 UDF 需要继承这个类来实现一个 UDF,并根据输入输出类型编写 evaluate 方法。
例如:
public class MyPlus extends UDF {
Long evaluate(Long a, Long b) {
if (a == null || b == null) {
return null;
}
return a + b;
}
}
| Constructor and Description |
|---|
UDF() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
setup(ExecutionContext ctx) |
public void setup(ExecutionContext ctx) throws UDFException, IOException
setup in interface ContextFunctionUDFExceptionIOExceptionpublic void close()
throws UDFException,
IOException
close in interface ContextFunctionUDFExceptionIOExceptionCopyright © 2021 Alibaba Cloud Computing. All rights reserved.