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

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Yun Tang
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
Reply | Threaded
Open this post in threaded view
|

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

Nicholas Jiang
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/
Reply | Threaded
Open this post in threaded view
|

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

Jark Wu-2
+1 to return emty iterator and align the implementations.

Best,
Jark

On Sat, 9 May 2020 at 19:18, SteNicholas <[hidden email]> 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/
>
Reply | Threaded
Open this post in threaded view
|

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

Pengfei Li
+1 to align the behavior

Jark Wu <[hidden email]> 于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 <[hidden email]> 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/
> >
>
Reply | Threaded
Open this post in threaded view
|

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

Yu Li
+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 <[hidden email]> wrote:

> +1 to align the behavior
>
> Jark Wu <[hidden email]> 于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 <[hidden email]> 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/
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

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

Congxian Qiu
+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 <[hidden email]> 于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 <[hidden email]> wrote:
>
> > +1 to align the behavior
> >
> > Jark Wu <[hidden email]> 于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 <[hidden email]> 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/
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

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

Yun Tang

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 <[hidden email]>
Sent: Monday, May 11, 2020 13:42
To: [hidden email] <[hidden email]>
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 <[hidden email]> 于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 <[hidden email]> wrote:
>
> > +1 to align the behavior
> >
> > Jark Wu <[hidden email]> 于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 <[hidden email]> 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/
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

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

Nicholas Jiang
In reply to this post by Congxian Qiu
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/
Reply | Threaded
Open this post in threaded view
|

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

Till Rohrmann
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 <[hidden email]> 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/
>