作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Spark 的文档中,聚合器:
abstract class Aggregator[-IN, BUF, OUT] extends Serializable
A base class for user-defined aggregations, which can beused in Dataset operations to take all of the elements of a group andreduce them to a single value.
abstract class UserDefinedAggregateFunction extends Serializable
The base class for implementing user-defined aggregate functions(UDAF).
最佳答案
除了类型之外,一个根本的区别是外部接口(interface):
Aggregator
需要一个完整的Row
(它适用于“强”类型的 API)。 UserDefinedAggregationFunction
需要一组 Columns
. Aggregator
不太灵活,尽管整体 API 更加用户友好。
Aggregator
是有状态的。取决于其缓冲区字段的可变内部状态。 UserDefinedAggregateFunction
是无国籍的。缓冲区的状态是外部的。 关于apache-spark - Spark : What is the difference between Aggregator and UDAF?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48180598/
我是一名优秀的程序员,十分优秀!