Search code examples
apache-flinkflink-streaming

value class type of flink mapstate


I would like to declare a flink mapState as below which value type is a pojo arraylist, what should I set its value class type?

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

it's not okay when I set value type to pojo.class or List.class. how to handle it?


Solution

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