| Package | Description |
|---|---|
| com.aliyun.odps.udf |
UDF API
主要包括
UDF(User Defined Function,用户自定义函数)
和 UDTF (User Defined Table-generating Function,用户自定义生成表函数) |
| com.aliyun.odps.udf.impl |
UDF SDK中用于内部实现的功能,这部分不属于API,接口随时可能改变,不推荐使用。
|
| Modifier and Type | Method and Description |
|---|---|
void |
ContextFunction.close() |
void |
UDF.close() |
void |
UDTF.close()
|
void |
Aggregator.close()
扫尾工作
|
abstract void |
Aggregator.iterate(Writable buffer,
Writable[] args)
对输入进行计算,生成中间结果
|
abstract void |
Aggregator.merge(Writable buffer,
Writable partial)
聚合中间结果,将 partial merge 到 buffer
|
abstract void |
UDTF.process(Object[] args)
用户代码必须实现
UDTF.process(Object[])方法。 |
OdpsType[] |
UDTF.resolve(OdpsType[] inputTypes)
Deprecated.
|
TypeInfo[] |
UDTF.resolve(TypeInfo[] typeInfos)
用于输入、输出类型
TypeInfo 之间的转换,默认调用 UDTF.resolve(OdpsType[])
不存在转换问题通常不需要关心。 |
void |
StandaloneUDTF.run()
run方法默认实现,每拉一条记录,调用一次process方法。
|
void |
ContextFunction.setup(ExecutionContext ctx) |
void |
UDF.setup(ExecutionContext ctx) |
void |
UDTF.setup(ExecutionContext ctx)
在
UDTF运行期,在每个Worker内UDTF.setup(ExecutionContext)会被先调用一次。 |
void |
Aggregator.setup(ExecutionContext ctx)
初始化工作。包括一些共享资源的载入等。
只在初始时被调用,建议一次性的操作都写入本方法。
资源载入通过
ExecutionContext 完成 |
abstract Writable |
Aggregator.terminate(Writable buffer)
生成最终结果
|
| Modifier and Type | Class and Description |
|---|---|
static class |
AnnotationParser.ParseError |
Copyright © 2021 Alibaba Cloud Computing. All rights reserved.