关注 spark技术分享,
撸spark源码 玩spark最佳实践

FlatMapGroupsWithState Unary Logical Operator

FlatMapGroupsWithState Unary Logical Operator

FlatMapGroupsWithState is a unary logical operator (i.e. LogicalPlan) that is created to represent the following operators in KeyValueGroupedDataset:

Note

FlatMapGroupsWithState is translated to:

  • FlatMapGroupsWithStateExec physical operator in FlatMapGroupsWithStateStrategy execution planning strategy for streaming Datasets (aka streaming plans)

  • MapGroupsExec physical operator in BasicOperators execution planning strategy for non-streaming/batch Datasets (aka batch plans)

Creating SerializeFromObject with FlatMapGroupsWithState — apply Factory Method

apply creates a SerializeFromObject logical operator with a FlatMapGroupsWithState as its child logical operator.

Internally, apply creates SerializeFromObject object consumer (aka unary logical operator) with FlatMapGroupsWithState logical plan.

Internally, apply finds ExpressionEncoder for the type S and creates a FlatMapGroupsWithState with UnresolvedDeserializer for the types K and V.

In the end, apply creates a SerializeFromObject object consumer with the FlatMapGroupsWithState.

Note
apply is used when flatMapGroupsWithState is executed.

Creating FlatMapGroupsWithState Instance

FlatMapGroupsWithState takes the following when created:

  • State function of type (Any, Iterator[Any], LogicalGroupState[Any]) ⇒ Iterator[Any]

  • Key deserializer Catalyst expression

  • Value deserializer Catalyst expression

  • Grouping attributes

  • Data attributes

  • Output object attribute

  • State ExpressionEncoder

  • Output mode

  • isMapGroupsWithState Flag (disabled by default)

  • GroupStateTimeout

  • Child logical operator

赞(0) 打赏
未经允许不得转载:spark技术分享 » FlatMapGroupsWithState Unary Logical Operator
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏