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

Liya Fan edited comment on CALCITE-4511 at 2/23/21, 5:50 AM:
-------------------------------------------------------------

[~julianhyde] Thanks for your feedback. 

{{NDV(i, j)}} means 
{noformat}
NDV ({i, j})
{noformat} 
That is, the number of distinct values for columns {{i}} and {{j}}. 
(i and j are column indices)

In the Calcite code, it should correspond to 
{{RelMetadataQuery#getDistinctRowCount(ImmutableBitSet.of(i, j))}}


was (Author: fan_li_ya):
[~julianhyde] Thanks for your feedback. 

{{NDV(i, j)}} means 
{noformat}
NDV ({i, j})
{noformat} 
That is, the number of distinct values for columns {{i}} and {{j}}. 

In the Calcite code, it should correspond to 
{{RelMetadataQuery#getDistinctRowCount(ImmutableBitSet.of(i, j))}}

> The number of distinct values for constant columns should be 1
> --------------------------------------------------------------
>
>                 Key: CALCITE-4511
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4511
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Liya Fan
>            Assignee: Liya Fan
>            Priority: Major
>
> Suppose we have a relation with 3 columns: {{(a, '1', '2')}}. The first 
> column comes from an underlying table, while the other two columns are 
> constants. 
> For this relation, we should have {{NDV(1) = 1}}, since column 1 is a 
> constant, which have only one possible value (suppose the column index starts 
> from 0).
> Similarly, we should have {{NDV(1, 2) = 1}}, since both columns are constants.
> We should also have {{NDV(0, 1) == NDV(0)}}, because the number of distinct 
> values depends on the non-const column, which is {{a}} from the underlying 
> table. 



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

Reply via email to