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

Julian Hyde commented on CALCITE-7803:
--------------------------------------

+1. If Calcite is seen as a collection of tools (like a compiler's tool chain) 
then it will be useful to a new class of users – people who are not necessarily 
building a DBMS.

My definition of "tool" is something that can be invoked from the OS shell. 
Like Unix commands 'grep' and 'uniq', a tool's documentation is via its 
{{--help}} flag. It could conceivably have a man page. I don't think we will 
make the effort to create a man page for each tool, but a single page on the 
site listing all tools would be useful.

> Extract rewritable materialized view fragments from queries
> -----------------------------------------------------------
>
>                 Key: CALCITE-7803
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7803
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>
> The MaterializedViewRules impose limitations on the shape of a query/plan 
> that can be used for query rewriting. There is a [validity 
> check|https://github.com/apache/calcite/blob/34db6c8cd895998f38175efc3e3306311fc7d061/core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java#L503]
>  that must be satisfied both by the operator matching the rule and the 
> materialized view candidate. In a nutshell only SPJA query/plans are allowed 
> with a few additional restrictions.
> The goal of this ticket is to add a new API/utility able to extract 
> rewritable materialized view fragments form an input query/plan. A fragment 
> is rewritable if it passes the validity check present in the materialized 
> view rules. The visitor should only extract maximal fragments; no containment 
> relationships among fragments.
> Consider the following query having a union with two branches. Observe that 
> both of the branches are rewritable but the whole query is not due to the 
> union.
> +Input+
> {code:sql}
> SELECT ename FROM emp WHERE empno = 1
> UNION
> SELECT ename FROM emp WHERE empno = 2
> {code}
> +Fragment 1+
> {code:sql}
> SELECT ename FROM emp WHERE empno = 1
> {code}
> +Fragment 2+
> {code:sql}
> SELECT ename FROM emp WHERE empno = 2
> {code}
> The {{SELECT ename FROM emp}} is also a rewritable fragment but its not 
> maximal thus its not part of the result. The examples above appear in SQL but 
> the algorithm applies at the algebra (RelNode) level.
> The API is meant to support optimizations around common table expressions and 
> materialized views. For instance, it can be used for workload analysis to 
> generate view based recommendations.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to