You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Yuta Morisawa <yu...@kddi-research.jp> on 2019/07/29 03:12:08 UTC

How to access state from another map functions

Hi all

I want to use the same state for multiple times.

stream
.keyBy(0)
.map(new MyRichMapfunction)
...
.keyBy(0)
.map(new MyRichMapfunction2)


In this snippet, I want access the same state in MyRichMapfunction and 
MyRichMapfunction2, but I failed in spite of keying the same key.
Is there any way to access the state from other class, or is there a 
kind of global state.

--
Thank you.
Yuta


Re: How to access state from another map functions

Posted by Yuta Morisawa <yu...@kddi-research.jp>.
Hi Biao

Thank you for your reply.
I will consulting in-memory DB.


On 2019/07/29 14:52, Biao Liu wrote:
> Hi Yuta,
> 
> No, you can't get the same state from different functions. That's not 
> the semantics of state. And these two functions might run in different 
> threads/processes even on different machines.
> 
> On Mon, Jul 29, 2019 at 11:12 AM Yuta Morisawa 
> <yu-morisawa@kddi-research.jp <ma...@kddi-research.jp>> wrote:
> 
>     Hi all
> 
>     I want to use the same state for multiple times.
> 
>     stream
>     .keyBy(0)
>     .map(new MyRichMapfunction)
>     ...
>     .keyBy(0)
>     .map(new MyRichMapfunction2)
> 
> 
>     In this snippet, I want access the same state in MyRichMapfunction and
>     MyRichMapfunction2, but I failed in spite of keying the same key.
>     Is there any way to access the state from other class, or is there a
>     kind of global state.
> 
>     --
>     Thank you.
>     Yuta
> 

-- 
--------------------------------------------
<KDDI総合研究所 ビジョン>
Challenge for the future 豊かな未来への挑戦
--------------------------------------------
Tomorrow, Together  KDDI
---------------------------------------------
   〒356-8502
 埼玉県ふじみ野市大原2丁目1番15号
 株式会社 KDDI総合研究所(KDDI Research, Inc.)
 コネクティッドカー1G
 森澤 雄太
 mail yu-morisawa@kddi-research.jp
 tel  070-3871-8883
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 この電子メールおよび添付書類は、名宛人のための
 特別な秘密情報を含んでおります。
 そのため、名宛人以外の方による利用は認められて
 おりません。
 名宛人以外の方による通信内容公表、複写、転用等
 は厳禁であり、違法となることがあります。
 万が一、何らかの誤りによりこの電子メールを名宛
 人以外の方が受信された場合は、お手数でも、直ち
 に発信人にお知らせ頂くと同時に、当メールを削除
 下さいますようお願い申し上げます。


Re: How to access state from another map functions

Posted by Biao Liu <mm...@gmail.com>.
Hi Yuta,

No, you can't get the same state from different functions. That's not the
semantics of state. And these two functions might run in different
threads/processes even on different machines.

On Mon, Jul 29, 2019 at 11:12 AM Yuta Morisawa <yu...@kddi-research.jp>
wrote:

> Hi all
>
> I want to use the same state for multiple times.
>
> stream
> .keyBy(0)
> .map(new MyRichMapfunction)
> ...
> .keyBy(0)
> .map(new MyRichMapfunction2)
>
>
> In this snippet, I want access the same state in MyRichMapfunction and
> MyRichMapfunction2, but I failed in spite of keying the same key.
> Is there any way to access the state from other class, or is there a
> kind of global state.
>
> --
> Thank you.
> Yuta
>
>