[
https://issues.apache.org/jira/browse/CALCITE-4215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17189872#comment-17189872
]
Vladimir Sitnikov commented on CALCITE-4215:
--------------------------------------------
{quote}In order to avoid the NPEs, we return -1 when we can not infer the
specific row count number.{quote}
This is interesting to know because numeric nulls should be relatively easy to
detect with IDE.
For instance {{if (rowCount != 0)}} would result in {{Unboxing of 'rowCount'
may produce 'NullPointerException'}} warning.
I think {{null}} for {{Double}} and {{Boolean}} metatada looks reasonable. It
On the other hand, all the current uses of
{{org.apache.calcite.rel.metadata.RelMetadataQuery#distribution}} would result
in NPE if we allow {{distribution}} to return null.
That is why I'm inlined that we should use something like the following:
{code:java}
RelDistribution distribution = distributionHandler.distribution(rel,
this);
if (distribution == null) {
return RelDistributions.ANY;
}
return distribution;
{code}
In other words, allow handlers to return {{null}}, however, convert it to the
default value, so {{RelMetadataQuery}} users don't need to deal with null
distributions.
> Ensure org.apache.calcite.schema.Statistic uses null vs emptyList
> appropriately
> -------------------------------------------------------------------------------
>
> Key: CALCITE-4215
> URL: https://issues.apache.org/jira/browse/CALCITE-4215
> Project: Calcite
> Issue Type: Sub-task
> Components: core
> Affects Versions: 1.25.0
> Reporter: Vladimir Sitnikov
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> null: statistic is *not* *known*
> emptyList: statistic is *known*, and the value is *empty* (e.g. no unique
> keys in the table)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)