[ https://issues.apache.org/jira/browse/CALCITE-4303?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206662#comment-17206662 ]
Vladimir Sitnikov commented on CALCITE-4303: -------------------------------------------- For instance, here's how RelInput is used in RexProgram (note that is has to use requireNonNull since getExpressionList returns nullable value): {code:java} final List<RexNode> exprs = requireNonNull(input.getExpressionList("exprs"), "exprs"); final List<RexNode> projectRexNodes = requireNonNull( input.getExpressionList("projects"), "projects"); {code} > Refactor org.apache.calcite.rel.RelInput to provide null-safe getters > --------------------------------------------------------------------- > > Key: CALCITE-4303 > URL: https://issues.apache.org/jira/browse/CALCITE-4303 > Project: Calcite > Issue Type: Sub-task > Components: core > Affects Versions: 1.25.0 > Reporter: Vladimir Sitnikov > Priority: Major > > There are several methods which might return null, however, they are used a > lot as "never null" ones: > {code:java} > <E extends Enum<E>> @Nullable E getEnum(String tag, Class<E> enumClass); > @Nullable List<RexNode> getExpressionList(String tag); > @Nullable List<String> getStringList(String tag); > @Nullable List<Integer> getIntegerList(String tag); > @Nullable List<List<Integer>> getIntegerListList(String tag); > {code} > It would be nice if the methods returned non-nullable values. > The suggested API is > {code:java} > <E extends Enum<E>> E getEnum(String tag, Class<E> enumClass); > List<RexNode> getExpressionList(String tag); > List<String> getStringList(String tag); > List<Integer> getIntegerList(String tag); > List<List<Integer>> getIntegerListList(String tag); > <E extends Enum<E>> @Nullable E getEnumOrNull(String tag, Class<E> > enumClass); > @Nullable List<RexNode> getExpressionListOrNull(String tag); > @Nullable List<String> getStringListOrNull(String tag); > @Nullable List<Integer> getIntegerListOrNull(String tag); > @Nullable List<List<Integer>> getIntegerListListOrNull(String tag); > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)