Re: Streaming statefull operator with hashmap

2015-11-18 Thread Stephan Ewen
For initializing the Map manually, I meant making "null" the default value and writing the code like HashMap map = state.value() if (map == null) { map = new HashMap<>(); } rather than expecting the state to always clone you a new empty map On Thu, Nov 12, 2015 at 11:29 AM, Aljoscha Krettek w

Re: Streaming statefull operator with hashmap

2015-11-12 Thread Aljoscha Krettek
Hi, you can do it using the register* methods on StreamExecutionEnvironment. So, for example: // set up the execution environment final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.registerType(InputType.class); env.registerType(MicroModel.class); I

Re: Streaming statefull operator with hashmap

2015-11-11 Thread Martin Neumann
Thanks for the help. TypeExtractor.getForObject(modelMapInit) did the job. Its possible that its an IDE problem that .getClass() did not work. Intellij is a bit fiddly with those things. 1) Making null the default value and initializing manually is probably more > efficient, because otherwise the

Re: Streaming statefull operator with hashmap

2015-11-11 Thread Stephan Ewen
It should suffice to do something like "getRuntimeContext().getKeyValueState("microModelMap", new HashMap().getClass(), null);" Two more comments: 1) Making null the default value and initializing manually is probably more efficient, because otherwise the empty map would have to be cloned each t

Re: Streaming statefull operator with hashmap

2015-11-11 Thread Gyula Fóra
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 ezt írta (időpont: 2015. nov. 11., Sz