You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Vladimir Sitnikov (Jira)" <ji...@apache.org> on 2020/09/05 23:04:00 UTC

[jira] [Comment Edited] (CALCITE-4226) Add Mappings#asListNonNull as a null-safe alternative for Mappings#asList

    [ https://issues.apache.org/jira/browse/CALCITE-4226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17191159#comment-17191159 ] 

Vladimir Sitnikov edited comment on CALCITE-4226 at 9/5/20, 11:03 PM:
----------------------------------------------------------------------

Hey Julian, I tried my best to accommodate your comments (==you asked to keep the exiting function as is, and I did exactly that!)
I sincerely do not understand what is so wrong with adding a helper function that provides user-friendly error message if it fails.

I've added a new function and a test for it. What is wrong with it?

Both variations are helpful: the old function returns list with nulls, and the second function would return non-nullable list when user knows in advance they want only non-nullable results. In return, the converter provides clear message instead of NPE.

What is wrong? Could you please suggest what should I do to make you less angry?


was (Author: vladimirsitnikov):
Hey Julian, I tried my best to accommodate your comments, and I sincerely do not understand what is so wrong with adding a helper function that provides user-friendly error message if it fails.

I've added a new function and a test for it. What is wrong with it?

Both variations are helpful: the old function returns list with nulls, and the second function would return non-nullable list when user knows in advance they want only non-nullable results. In return, the converter provides clear message instead of NPE.

What is wrong? Could you please suggest what should I do to make you less angry?

> Add Mappings#asListNonNull as a null-safe alternative for Mappings#asList
> -------------------------------------------------------------------------
>
>                 Key: CALCITE-4226
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4226
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: core
>    Affects Versions: 1.25.0
>            Reporter: Vladimir Sitnikov
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.26.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> It looks like none of the uses for Mappings#asList is ready to handle nulls.
> So far there are 6 usages of the method, however, it is puzzling if NPE is expected behavior there.
> I'm inclined to create two variations of the method:
> 1) {{List<@Nullable Integer> asList(...)}} -- keep the current method current one
> 2) {{List<@NonNull Integer> asList(...)}} -- throw exceptions on invalid mappings



--
This message was sent by Atlassian Jira
(v8.3.4#803005)