[
https://issues.apache.org/jira/browse/CALCITE-3428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16955666#comment-16955666
]
Julian Hyde commented on CALCITE-3428:
--------------------------------------
This is a useful change; I'm glad you're doing it.
Did you consider driving from {{RelMdPredicates}}? {{Filter}} creates
predicates, but so do many other kinds of {{RelNode}}, and moreover, predicates
are propagated. So if you use {{RelMdPredicates}} this rule will apply in more
cases.
Also, it will allow you to use {{RelOptPredicateList.constantMap}}, which will
save you the effort of parsing conditions to look for conditions of the form
'column = constant'.
{{testAggregateRemove7}} needs a javadoc comment to explain its purpose.
> Refine RelMdColumnUniqueness for Filter by considering constant columns
> -----------------------------------------------------------------------
>
> Key: CALCITE-3428
> URL: https://issues.apache.org/jira/browse/CALCITE-3428
> Project: Calcite
> Issue Type: Improvement
> Reporter: jin xing
> Assignee: jin xing
> Priority: Major
> Labels: pull-request-available
> Time Spent: 40m
> Remaining Estimate: 0h
>
> AggregateRemoveRule fails to remove the top Aggregate for below SQL
> {code:java}
> select mgr, sum(sum_sal)
> from
> (select mgr, deptno, sum(sal) sum_sal
> from sales.emp
> group by mgr, deptno)
> where deptno=100
> group by mgr
> {code}
> The reason is that RelMdColumnUniqueness doesn't take the filtering condition
> into consideration when checking uniqueness of columns.
> This PR proposes to refine RelMdColumnUniqueness for Filter, thus to
> strengthen AggregateRemoveRule.
> Resolving this Jira will help a lot for CALCITE-3334 by removing the
> redundant compensation Aggregate when doing materialization matching
--
This message was sent by Atlassian Jira
(v8.3.4#803005)