You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Jerome Li <li...@vmware.com> on 2021/08/05 23:57:17 UTC

Best Practice of Using HashSet State

Hi,

I am new to Flink and state backend. I find Flink does provide ValueState, ListState, and MapState. But it does not provide State object for HashSet. What is the best practice of storing HashSet State in Flink? Should we use ValueState and set the value to be HashSet? Or should we use ListState and implement a wrapper class for serializing and desterilizing the HashSet to List?

Any help would be appreciated!

Best,
Jerome

Re: Best Practice of Using HashSet State

Posted by Yun Tang <my...@live.com>.
Hi Jerome,

The type of value, list and map means that the structure of value to the primary key. I am not sure what the set structure you mean here, if you want to let the value as a set, and you can just leverage map state. As you might know, java actually use HashMap to implement the HashSet.

Best
Yun Tang
________________________________
From: Jerome Li <li...@vmware.com>
Sent: Friday, August 6, 2021 7:57
To: user@flink.apache.org <us...@flink.apache.org>
Subject: Best Practice of Using HashSet State


Hi,



I am new to Flink and state backend. I find Flink does provide ValueState, ListState, and MapState. But it does not provide State object for HashSet. What is the best practice of storing HashSet State in Flink? Should we use ValueState and set the value to be HashSet? Or should we use ListState and implement a wrapper class for serializing and desterilizing the HashSet to List?



Any help would be appreciated!



Best,

Jerome