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

Ran Tao edited comment on CALCITE-5908 at 8/8/23 4:07 PM:
----------------------------------------------------------

[~jhyde] I have checked it. it's a very old version in 1.13 make this change. 
[https://github.com/apache/calcite/pull/421/files#diff-1db549e5bc5ea88fef304211584d9fef15761178fc4d7f7bb22254db38695cf2]

then a commit change it to  Guava Preconditions.checkNotNull.

And in another commit 'Change Guava Preconditions.checkNotNull to Java
Objects.requireNonNull. (Kevin Risden)' change to requireNonNull.

The latest commit change requireNonNull to requireNonNull(a, 'a') with message.

While follow the initial commit above, there is no need to check this null in 
else branch. WDYT?


was (Author: lemonjing):
[~jhyde] I have checked it. it's a very old version in 1.13 make this change. 
https://github.com/apache/calcite/pull/421/files#diff-1db549e5bc5ea88fef304211584d9fef15761178fc4d7f7bb22254db38695cf2

And after a commit change it to  Guava Preconditions.checkNotNull.

And in another commit 'Change Guava Preconditions.checkNotNull to Java
Objects.requireNonNull. (Kevin Risden)' change to requireNonNull.

The latest commit change requireNonNull to requireNonNull(a, 'a') with message.

While follow the initial commit above, there is no need to check this null in 
else branch. WDYT?

> Remove unnecessary NULL checks in CalciteSchema
> -----------------------------------------------
>
>                 Key: CALCITE-5908
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5908
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.35.0
>            Reporter: Ran Tao
>            Assignee: Ran Tao
>            Priority: Minor
>              Labels: pull-request-available
>
> When i read the source code of `CalciteSchema` found so many null checks 
> below:
>  
> {code:java}
>     if (tableMap == null) {
>       this.tableMap = new NameMap<>();
>     } else {
>       this.tableMap = Objects.requireNonNull(tableMap, "tableMap");
>     }
>     if (latticeMap == null) {
>       this.latticeMap = new NameMap<>();
>     } else {
>       this.latticeMap = Objects.requireNonNull(latticeMap, "latticeMap");
>     } {code}
> i think we can remove it. it was misleading.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to