flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Neumann <mneum...@sics.se>
Subject Streaming statefull operator with hashmap
Date Wed, 11 Nov 2015 15:29:58 GMT
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