You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/12/03 03:58:34 UTC

[GitHub] [calcite] twdsilva commented on pull request #2876: [CALCITE-5240] Enhance MaterializedViewRule so that it applies to rol…

twdsilva commented on PR #2876:
URL: https://github.com/apache/calcite/pull/2876#issuecomment-1336037626

   > @twdsilva thanks for the PR, I think it's a very useful feature, I still share the doubts that @julianhyde raised in a [jira comment](https://issues.apache.org/jira/browse/CALCITE-5240?focusedCommentId=17598705&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17598705) (copying a filter into the view seems hacky and does not always seem safe) and that @zabetak raised [in the ML](https://lists.apache.org/thread/6c1x985qrzjvd1tc38kmcj56hs9q43bw) (isn't there a way to modify the query to match the view, instead of changing the view and making view matching more complex?).
   > 
   > In the same ML discussion, you have raised a question on this point, I don't have an answer to that myself, but I feel that the we all need to agree that we are going into the right direction before being able to merge the PR.
   
   Thank you @asolimando for the review. 
   We have a use case where we maintain materialized preaggregated cubes that store data rolled up to the UTC day or hour. The queries in our system always have a time range predicate that doesn't neccesarily align on the UTC day or boundary. We would like to use the materialized cube table whenever possible. Here is an [example](https://github.com/twilio/calcite-kudu/blob/30c0d4e7b1d15288f7c30cdfda885c0c3a4666bf/adapter/src/test/java/com/twilio/kudu/sql/ScenarioIT.java#L278).
   I could not figure how to get `MaterializedViewAggregateRule`  to handle the case when a view contains a rollup (has a group by with a `FLOOR(col)`) other than rewriting the view to include a predicate based on the query predicate. The existing code that uses the union operator works if we include this generated predicate. The other main change is to map `FLOOR(col)` to col which is valid because the predicate added to the view is aligned on the floored value of the query predicate. If there is a cleaner way to make this work I would appreciate any pointers. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org