[ https://issues.apache.org/jira/browse/HIVE-26160?focusedWorklogId=762896&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-762896 ]
ASF GitHub Bot logged work on HIVE-26160: ----------------------------------------- Author: ASF GitHub Bot Created on: 27/Apr/22 14:02 Start Date: 27/Apr/22 14:02 Worklog Time Spent: 10m Work Description: kasakrisz commented on code in PR #3246: URL: https://github.com/apache/hive/pull/3246#discussion_r859840470 ########## ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java: ########## @@ -2107,7 +2108,10 @@ private boolean isMaterializedViewRewritingByTextEnabled() { } private RelNode applyMaterializedViewRewritingByText( - ASTNode queryToRewriteAST, RelNode originalPlan, RelOptCluster optCluster) { + ASTNode queryToRewriteAST, + RelNode originalPlan, + RelOptCluster optCluster, + RelMetadataProvider metadataProvider) { Review Comment: It returns a different provider. [removeSubqueries](https://github.com/apache/hive/blob/7583142cbffcb3958a546a9aaa15700bbc243df9/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java#L2395) could also get a provider from the plan in it's 1st param like ``` basePlan.getCluster().getMetadataProvider() ``` However this does not returns the same instance passed in the 2nd parameter. One provider instance has 14 entries the other one has 22. Issue Time Tracking ------------------- Worklog Id: (was: 762896) Time Spent: 1h (was: 50m) > Materialized View rewrite does not check tables scanned in sub-query > expressions > -------------------------------------------------------------------------------- > > Key: HIVE-26160 > URL: https://issues.apache.org/jira/browse/HIVE-26160 > Project: Hive > Issue Type: Bug > Components: CBO, Materialized views > Reporter: Krisztian Kasa > Assignee: Krisztian Kasa > Priority: Major > Labels: pull-request-available > Time Spent: 1h > Remaining Estimate: 0h > > Materialized View rewrite based on exact sql text match uses the initial CBO > plan to explore possibilities to change the query plan or part of the plan to > an MV scan. > This algorithm requires the tables scanned by the original query plan. If the > query contains sub query expressions the tables scanned by the sub query are > not listed which can lead to rewrite the original plan to scan an outdated MV. -- This message was sent by Atlassian Jira (v8.20.7#820007)