| 程序包 | 说明 |
|---|---|
| com.aliyun.odps.udf |
UDF API
主要包括
UDF(User Defined Function,用户自定义函数)
和 UDTF (User Defined Table-generating Function,用户自定义生成表函数) |
| com.aliyun.odps.udf.impl |
UDF SDK中用于内部实现的功能,这部分不属于API的一部分,接口随时可能改变,不推荐使用。
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
Aggregator.close()
扫尾工作
|
void |
UDTF.close()
|
void |
ContextFunction.close() |
void |
UDF.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)
用于输入、输出类型
OdpsType 之间的转换,默认调用 UDTF.initialize(OdpsType[])
不存在转换问题通常不需要关心。 |
void |
StandaloneUDTF.run()
run方法默认实现,每拉一条记录,调用一次process方法。
|
void |
Aggregator.setup(ExecutionContext ctx)
初始化工作。
|
void |
UDTF.setup(ExecutionContext ctx)
在
UDTF运行期,在每个Worker内UDTF.setup(ExecutionContext)会被先调用一次。 |
void |
ContextFunction.setup(ExecutionContext ctx) |
void |
UDF.setup(ExecutionContext ctx) |
abstract Writable |
Aggregator.terminate(Writable buffer)
生成最终结果
|
| 限定符和类型 | 类和说明 |
|---|---|
static class |
AnnotationParser.ParseError |
Copyright © 2015 Alibaba Cloud Computing. All rights reserved.