You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jesus Camacho Rodriguez (JIRA)" <ji...@apache.org> on 2019/03/25 18:00:00 UTC

[jira] [Resolved] (CALCITE-2943) Materialized view rewriting logic calls getApplicableMaterializations each time the rule is triggered

     [ https://issues.apache.org/jira/browse/CALCITE-2943?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jesus Camacho Rodriguez resolved CALCITE-2943.
----------------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.20.0

Fixed in [ecc100ea23bdb5dd1a4c34633c3a376856b64970|https://github.com/apache/calcite/commit/ecc100ea23bdb5dd1a4c34633c3a376856b64970].

> Materialized view rewriting logic calls getApplicableMaterializations each time the rule is triggered
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2943
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2943
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.20.0
>
>         Attachments: Screen Shot 2019-03-21 at 2.33.01 PM.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {{RelOptMaterializations.getApplicableMaterializations}} is called each time the rule is triggered.
> {code:java}
> ...
>       // Obtain applicable (filtered) materializations
>       // TODO: Filtering of relevant materializations needs to be
>       // improved so we gather only materializations that might
>       // actually generate a valid rewriting.
>       final List<RelOptMaterialization> applicableMaterializations =
>           RelOptMaterializations.getApplicableMaterializations(node, materializations);
> ...
> {code}
> When I implemented the rule, I assumed (incorrectly) that {{getApplicableMaterializations}} was a lightweight call and hence would help discarding materialized views extracted from the planner quickly. It turns out that the method can quickly become the most time consuming part of the rule execution; I assume the method was just supposed to be used once per query.
> !Screen Shot 2019-03-21 at 2.33.01 PM.png!
> Since the prefiltering that we do right now is rather simple and we already extract the tables used by queries and materializations within the rule, we can just skip the materialization over there.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)