You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by Yun Tang <my...@LIVE.COM> on 2020/05/09 10:15:18 UTC

[DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Hi devs

This thread is inspired by FLINK-17015 [1] which meet NEP when SQL guys develop operator based on internal map state.

Unfortunately, we have different behavior of result of internal map state. For HeapMapState, #entries(), #keys(), #values(), and #iterator() would all return null. However, for RocksDBMapState, #entries() would return null, while #keys(), #values(), #iterator() would return empty iterator.

I cannot see real benefit for these different behaviors which would confuse internal developers. Moreover, UserFacingMapState would align these behaviors to empty iterator for users. I suggest to align these internal behavior to return empty iterator instead of null.

What do you think?


[1] https://issues.apache.org/jira/browse/FLINK-17015

Best
Yun Tang

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Till Rohrmann <tr...@apache.org>.
A bit late but also +1 for the proposal to return an empty
iterator/collection.

Cheers,
Till

On Mon, May 11, 2020 at 11:17 AM SteNicholas <pr...@163.com> wrote:

> Hi Tang Yun,
>     I have already created new issue for FLINK-17610 to align the behavior
> of result of internal map state to return empty iterator. Please check this
> issue, if you have any question for it, please let me know about this.
>
>
> Thanks,
> Nicholas Jiang
>
>
>
> --
> Sent from: http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by SteNicholas <pr...@163.com>.
Hi Tang Yun,
    I have already created new issue for FLINK-17610 to align the behavior
of result of internal map state to return empty iterator. Please check this
issue, if you have any question for it, please let me know about this.


Thanks,
Nicholas Jiang



--
Sent from: http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Yun Tang <my...@live.com>.
Thanks for everyone's positive response. FLINK-17610 [1] have been created to track this problem.


[1] https://issues.apache.org/jira/browse/FLINK-17610

Best
Yun Tang
________________________________
From: Congxian Qiu <qc...@gmail.com>
Sent: Monday, May 11, 2020 13:42
To: dev@flink.apache.org <de...@flink.apache.org>
Subject: Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

+1 to align the behavior to returning empty iterator. and I think this is
what's the code style[1] said.

Best,
Congxian


Yu Li <ca...@gmail.com> 于2020年5月11日周一 上午11:42写道:

> +1 to align the behavior to returning empty iterator. There's no `Nullable`
> annotation on the `MapState` interfaces, either.
>
> Best Regards,
> Yu
>
>
> On Mon, 11 May 2020 at 11:21, Pengfei Li <lp...@gmail.com> wrote:
>
> > +1 to align the behavior
> >
> > Jark Wu <im...@gmail.com> 于2020年5月9日周六 下午9:36写道:
> >
> > > +1 to return emty iterator and align the implementations.
> > >
> > > Best,
> > > Jark
> > >
> > > On Sat, 9 May 2020 at 19:18, SteNicholas <pr...@163.com> wrote:
> > >
> > > > Hi Tang Yun,
> > > >      I agree with the point you mentioned that align these internal
> > > > behavior
> > > > to return empty iterator instead of null. In my opinion,
> > > > StateMapViewWithKeysNullable handle nullable map keys, and result of
> > > > internal map state should be empty map in the null behavior case.
> > > > Therefore,
> > > > as you mentioned, #iterator() should better return empty iterator.
> > > >
> > > > Thanks,
> > > > Nicholas Jiang
> > > >
> > > >
> > > >
> > > > --
> > > > Sent from:
> > > http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
> > > >
> > >
> >
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Congxian Qiu <qc...@gmail.com>.
+1 to align the behavior to returning empty iterator. and I think this is
what's the code style[1] said.

Best,
Congxian


Yu Li <ca...@gmail.com> 于2020年5月11日周一 上午11:42写道:

> +1 to align the behavior to returning empty iterator. There's no `Nullable`
> annotation on the `MapState` interfaces, either.
>
> Best Regards,
> Yu
>
>
> On Mon, 11 May 2020 at 11:21, Pengfei Li <lp...@gmail.com> wrote:
>
> > +1 to align the behavior
> >
> > Jark Wu <im...@gmail.com> 于2020年5月9日周六 下午9:36写道:
> >
> > > +1 to return emty iterator and align the implementations.
> > >
> > > Best,
> > > Jark
> > >
> > > On Sat, 9 May 2020 at 19:18, SteNicholas <pr...@163.com> wrote:
> > >
> > > > Hi Tang Yun,
> > > >      I agree with the point you mentioned that align these internal
> > > > behavior
> > > > to return empty iterator instead of null. In my opinion,
> > > > StateMapViewWithKeysNullable handle nullable map keys, and result of
> > > > internal map state should be empty map in the null behavior case.
> > > > Therefore,
> > > > as you mentioned, #iterator() should better return empty iterator.
> > > >
> > > > Thanks,
> > > > Nicholas Jiang
> > > >
> > > >
> > > >
> > > > --
> > > > Sent from:
> > > http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
> > > >
> > >
> >
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Yu Li <ca...@gmail.com>.
+1 to align the behavior to returning empty iterator. There's no `Nullable`
annotation on the `MapState` interfaces, either.

Best Regards,
Yu


On Mon, 11 May 2020 at 11:21, Pengfei Li <lp...@gmail.com> wrote:

> +1 to align the behavior
>
> Jark Wu <im...@gmail.com> 于2020年5月9日周六 下午9:36写道:
>
> > +1 to return emty iterator and align the implementations.
> >
> > Best,
> > Jark
> >
> > On Sat, 9 May 2020 at 19:18, SteNicholas <pr...@163.com> wrote:
> >
> > > Hi Tang Yun,
> > >      I agree with the point you mentioned that align these internal
> > > behavior
> > > to return empty iterator instead of null. In my opinion,
> > > StateMapViewWithKeysNullable handle nullable map keys, and result of
> > > internal map state should be empty map in the null behavior case.
> > > Therefore,
> > > as you mentioned, #iterator() should better return empty iterator.
> > >
> > > Thanks,
> > > Nicholas Jiang
> > >
> > >
> > >
> > > --
> > > Sent from:
> > http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
> > >
> >
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Pengfei Li <lp...@gmail.com>.
+1 to align the behavior

Jark Wu <im...@gmail.com> 于2020年5月9日周六 下午9:36写道:

> +1 to return emty iterator and align the implementations.
>
> Best,
> Jark
>
> On Sat, 9 May 2020 at 19:18, SteNicholas <pr...@163.com> wrote:
>
> > Hi Tang Yun,
> >      I agree with the point you mentioned that align these internal
> > behavior
> > to return empty iterator instead of null. In my opinion,
> > StateMapViewWithKeysNullable handle nullable map keys, and result of
> > internal map state should be empty map in the null behavior case.
> > Therefore,
> > as you mentioned, #iterator() should better return empty iterator.
> >
> > Thanks,
> > Nicholas Jiang
> >
> >
> >
> > --
> > Sent from:
> http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
> >
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by Jark Wu <im...@gmail.com>.
+1 to return emty iterator and align the implementations.

Best,
Jark

On Sat, 9 May 2020 at 19:18, SteNicholas <pr...@163.com> wrote:

> Hi Tang Yun,
>      I agree with the point you mentioned that align these internal
> behavior
> to return empty iterator instead of null. In my opinion,
> StateMapViewWithKeysNullable handle nullable map keys, and result of
> internal map state should be empty map in the null behavior case.
> Therefore,
> as you mentioned, #iterator() should better return empty iterator.
>
> Thanks,
> Nicholas Jiang
>
>
>
> --
> Sent from: http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/
>

Re: [DISCUSS] Align the behavior of internal return result of MapState#entries, keys, values and iterator.

Posted by SteNicholas <pr...@163.com>.
Hi Tang Yun,
     I agree with the point you mentioned that align these internal behavior
to return empty iterator instead of null. In my opinion,
StateMapViewWithKeysNullable handle nullable map keys, and result of
internal map state should be empty map in the null behavior case. Therefore,
as you mentioned, #iterator() should better return empty iterator.

Thanks,
Nicholas Jiang



--
Sent from: http://apache-flink-mailing-list-archive.1008284.n3.nabble.com/