flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gyula Fóra <gyula.f...@gmail.com>
Subject Re: Streaming statefull operator with hashmap
Date Wed, 11 Nov 2015 15:32:56 GMT
Hey,

Yes what you wrote should work. You can alternatively use
TypeExtractor.getForObject(modelMapInit) to extract the tye information.

I also like to implement my custom type info for Hashmaps and the other
types and use that.

Cheers,
Gyula

Martin Neumann <mneumann@sics.se> ezt írta (időpont: 2015. nov. 11., Sze,
16:30):

> Hej,
>
> What is the correct way of initializing a state-full operator that is using
> a hashmap? modelMapInit.getClass() does not work neither does
> HashMap.class. Do I have to implement my own TypeInformation class or is
> there a simpler way?
>
> cheers Martin
>
> private OperatorState<HashMap<InputType,MicroModel>> microModelMap;
>
> @Override
> public void open(Configuration parameters) throws Exception {
>     HashMap<InputType,MicroModel> modelMapInit = new HashMap<>();
>     this.microModelMap =
> getRuntimeContext().getKeyValueState("microModelMap",
> modelMapInit.getClass() , modelMapInit);
> }
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message