[
https://issues.apache.org/jira/browse/CALCITE-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15224974#comment-15224974
]
Maryann Xue commented on CALCITE-1182:
--------------------------------------
[~julianhyde], It turned out that adding that single line of change exposed a
few other issues in SubstitutionVisitor:
1. Because the Project over "select *" statement no longer exists, what used to
match "ProjectToProjectUnifyRule1" now goes to "FilterToFilterUnifyRule" or
"FilterToProjectUnifyRule".
2. The FilterToFilterUnifyRule has not been covered by any test cases before
and does not work correctly at all after (1).
3. Small bug in "FilterToProjectUnifyRule": it should have checked that the new
projects have full coverage for the node it's going to replace.
4. In SubstitutionVisitor.go(), we should not remove all corresponding entries
once we find a match, since there can be multiple identical rels in the query,
e.g. a self-join has two identical TableScans.
Could you please take a look at
https://github.com/maryannxue/calcite/tree/calcite-1182? It works for all the
test case including a newly added one, but I would like to suggest more code
refinement to reduce code redundancy.
> Add ProjectRemoveRule to pre-processing program of materialization
> substitution
> -------------------------------------------------------------------------------
>
> Key: CALCITE-1182
> URL: https://issues.apache.org/jira/browse/CALCITE-1182
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Maryann Xue
> Assignee: Maryann Xue
> Priority: Minor
> Labels: materializedviews, phoenix
>
> In VolcanoPlanner, we apply a simple pre-processing hep program to normalize
> the "target" and "query" rels before materialization substitution. Currently
> this program runs with two rules: FilterProjectTransposeRule and
> ProjectMergeRule.
> We need an extra rule ProjectRemoveRule for the Phoenix use case where a
> secondary index (modeled as materialized views) is defined on a view so the
> materialized view "queryRel" may have an identity projection introduced by
> this view.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)