zoukankan      html  css  js  c++  java
  • Flink实例(三十四):状态管理(五)自定义键控状态(四)ReducingState与AggregatingState

    ReducingStateAggregatingState在注册StateDescriptor时,还需要实现一个ReduceFunctionAggregationFunction。下面的代码注册ReducingStateDescriptor时实现一个YourReduceFunctionYourReduceFunction实现了ReduceFunction。我们在ReducingState中使用add(in: T)方法向状态里增加一个元素,新元素和状态中已有数据通过ReduceFunction两两聚合。AggregatingState的使用方法与之类似。

    val reducingStateDescriptor = new ReducingStateDescriptor[UserBehavior]("reducing", new YourReduceFunction, classOf[UserBehavior])

    本文来自博客园,作者:秋华,转载请注明原文链接:https://www.cnblogs.com/qiu-hua/p/13794960.html

  • 相关阅读:
    跳转
    登录
    计算器
    安卓作业
    第十三周作业
    第十三周上机练习
    第十二周作业
    第十二周上机作业
    第八周作业
    第七周作业
  • 原文地址:https://www.cnblogs.com/qiu-hua/p/13794960.html
Copyright © 2011-2022 走看看