【发布时间】:2021-04-13 02:29:58
【问题描述】:
打算在processBroadcastElement()函数内部做一些状态管理。
final val actvTagsMapValue = new MapStateDescriptor[String, List[String]]("actvTagsMapValue", classOf[String], classOf[List[String]])
override def processBroadcastElement(...): Unit {
val actvTagMap = getRuntimeContext.getMapState(actvTagsMapValue)
val st = actvTagMap.entries() // this line produce an error
}
访问状态时出现以下错误
229797 [LabelShlfEvents -> Sink: Print to Std. Out (1/1)] WARN
o.a.flink.runtime.taskmanager.Task - LabelShlfEvents -> Sink: Print to Std. Out (1/1)
(d3154841fd8bd4cabc00e0145ac37ed8) switched from RUNNING to FAILED.
java.lang.NullPointerException: No key set. This method should not be called outside of a keyed context.
at org.apache.flink.util.Preconditions.checkNotNull(Preconditions.java:75)
我不能这样做吗?
【问题讨论】:
标签: apache-flink