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

Vladimir Sitnikov commented on CALCITE-4215:
--------------------------------------------

I'm afraid -1 would be much harder to notice with IDE :-(

We could borrow an idea {{get...OrNull}} from other libraries. We can have two 
metadata APIs: one which is null returning, and another that returns a 
good-looking default.

For instance: {{getRowCount}} (throws on null) vs {{getRowCountOrNull}} (return 
nulls).
Alternative: {{getRowCount}} (returns 100 in case row count is unknown) vs 
{{getRowCountOrNull}} (return null).

In other words, the default method could return something that makes sense in 
most of the cases, and there might be a method that returns raw {{null}} for 
that 0.1% when it matters.

In practice, we already have 
{{org.apache.calcite.rel.metadata.RelMetadataQuery#getAverageColumnSizes}} vs 
{{org.apache.calcite.rel.metadata.RelMetadataQuery#getAverageColumnSizesNotNull}},
 however it would read easier if {{OrNull}} was explicitly present in the 
method name.




> 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)

Reply via email to