flink mapstate的值类类型



我想声明一个flink mapState,在下面哪个值类型是pojo arraylist,我应该设置它的值类类型?

private transient MapState<String, List<pojo>> mapState;
mapState = getRuntimeContext().getMapState(
new MapStateDescriptor<String, List<pojo>>(
"RIGHT_BUFFER",
String.class,
???
)
);

当我将值类型设置为CCD_ 1或CCD_。如何处理?

private final MapStateDescriptor<String, List<Pojo>> mapStateDesc =
new MapStateDescriptor<>(
"RIGHT_BUFFER",
BasicTypeInfo.STRING_TYPE_INFO,
new ListTypeInfo<>(Pojo.class));

您需要将TypeInformationTypeHint一起使用来处理泛型类。类似于:

mapState = getRuntimeContext().getMapState(
new MapStateDescriptor<String, List<pojo>>(
"RIGHT_BUFFER",
TypeInformation.of(String.class),
TypeInformation.of(new TypeHint<List<pojo>>() {})
)
);

相关内容

  • 没有找到相关文章

最新更新