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

Stamatis Zampetakis commented on CALCITE-3409:
----------------------------------------------

Hey [~xzh_dz], I had another a look in the PR and I think we should take a 
slightly different direction and treat this issue and CALCITE-4395 together. I 
agree with the overall requirement that we should make the Substitution based 
rewritting process more extensible but instead of adding multiple new methods 
in {{RelOptPlanner}} I think we should focus on another abstraction (e.g., new 
interface {{RelViewFinder}}, {{RelMaterializationFinder}}, 
{{RelOptMaterializationFinder}}, or something else along these lines) 
responsible for the normalization and unification processes. Moreover the new 
abstraction should allow full control about the normalization and unification 
(not only adding rules to the default ones).

Then we could pass this new abstraction to the planner via a new setter, and/or 
getter, and/or Context.

I am hoping that with this approach we could cover also use-cases that may 
appear in the future and possibly refactor some existing code that is related 
together.

> Add an interface in MaterializedViewSubstitutionVisitor to allow registering 
> UnifyRule
> --------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3409
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3409
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Jin Xing
>            Assignee: Jin Xing
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 5h 40m
>  Remaining Estimate: 0h
>
> In current code of MaterializedViewSubstitutionVisitor, all matching rules 
> are internal defined. The existing rules support the most popular scenarios. 
> But my customers sometimes ask for the ability to self define some matching 
> rules, thus to support some special scenarios.
> I take below example as an illustration:
> {code:java}
> Query:
> select * from table
> where from_unixtime(_EVENT_TIME_, "yyyymmdd hh") >= "20190909 00"
> and from_unixtime(_EVENT_TIME_, "yyyymmdd hh") <= "20190909 23" ;
> Materialized View:
> select * from table 
> where from_unixtime(_EVENT_TIME_, "yyyymmdd") = "20190909";{code}
> It's hard to enumerate the matching pattern for different functions in 
> internal matching rules. We can expose a method to register new UnifyRules 
> and allow user to extend the ability of MV matching



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to