[
https://issues.apache.org/jira/browse/CALCITE-4465?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130292#comment-18130292
]
Vladimir Sitnikov commented on CALCITE-4465:
--------------------------------------------
Closed the PR https://github.com/apache/calcite/pull/2330 because it no longer
applies to main ({{Sarg.containsNull}} was removed in favor of {{Sarg.nullAs}},
and four of the six files conflict). The idea is still unimplemented:
{{RelMdDistinctRowCount.getDistinctRowCount(Filter, ...)}} forwards the
predicate without deriving a bound. I am unassigning the issue so that someone
else can pick it up; the PR comment lists what a new PR needs.
> Estimate the number of distinct values by filter condition
> ----------------------------------------------------------
>
> Key: CALCITE-4465
> URL: https://issues.apache.org/jira/browse/CALCITE-4465
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Liya Fan
> Assignee: Liya Fan
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> According to our current implementation ({{RelMdDistinctRowCount}}),
> estimating the number of distinctive values (NDV) does not make good use of
> the filter condition. It simply forwards the call to its input operator with
> the fiter condition attached.
> In fact, more information can be obtained for some special but commonly used
> conditions. For example, given condition {{x = 'a'}}, we can deduce that
> {{NDV( x ) <= 1}}. Given condition {{x in ('a', 'b')}}, we can deduce that
> {{NDV( x ) <= 2}}.
> More generally, if we have {{x in ('a', 'b') AND y in ('c', 'd', 'e')}}, we
> have {{NDV(x, y) <= 2 * 3 = 6}}.
> Thoughts?
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)