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/11/02 23:09:00 UTC

[jira] [Commented] (CALCITE-4372) Correct specification getCumulativeCost and getNonCumulativeCost so it should always produce non-nullable value

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

Vladimir Sitnikov commented on CALCITE-4372:
--------------------------------------------

Possible approaches:
1) Throw NPE in case {{cumulativeCostHandler}} returns null, require clients to return non-null values
2) Convert {{null}} from {{cumulativeCostHandler}} to {{infinite}} cost. Reasoning: it is unknown, so it might be greater than something known.

Note: VolcanoPlanner still needs to compare costs, so if we want to support null costs in VolcanoPlanner, then we would need to create rules to compare {{non-null}} vs {{null}} cost.

That is why I suggest {{org.apache.calcite.rel.metadata.RelMetadataQuery#getNonCumulativeCost}} should convert {{null}} to {{infinite}} cost.

[~botong], [~julianhyde], any thoughts, objections?

> Correct specification getCumulativeCost and getNonCumulativeCost so it should always produce non-nullable value
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4372
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4372
>             Project: Calcite
>          Issue Type: Sub-task
>          Components: core
>    Affects Versions: 1.26.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Vladimir Sitnikov
>            Priority: Major
>
> Currently javadoc says {{getNonCumulativeCost}} can return {{null}}, however, a lot of usages assume the resulting value is not null.
> For instance, FLINK-11973 is relevant here.
> Even though plugins can install custom {{getNonCumulativeCost}} handlers, we should make {{get*CumulativeCost}} non-nullable, so {{RelOptPlanner.getCost}} could be declared and implemented as non-nullable (which is the way the current code behaves)



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