kasakrisz commented on a change in pull request #1706:
URL: https://github.com/apache/hive/pull/1706#discussion_r540056128
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
##########
@@ -1945,6 +1945,18 @@ public RelOptMaterialization
getMaterializedViewForRebuild(String dbName, String
}
}
+ public List<RelOptMaterialization> getMaterialization(
+ String queryString, List<String> tablesUsed, HiveTxnManager txnMgr)
throws HiveException {
+
+ List<RelOptMaterialization> materializedViews =
+
HiveMaterializedViewsRegistry.get().getRewritingMaterializedViews(queryString);
+ if (materializedViews.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ return filterAugmentMaterializedViews(materializedViews, tablesUsed,
txnMgr);
Review comment:
refactored this method: instead of calling
`filterAugmentMaterializedViews` iterate through the mvs got from the registry
and call `HiveMaterializedViewUtils.isOutdatedMaterializedView` for each of
them. If it returns `null` or `true` filter out.
The majority of the code in `getValidMaterializedViews` can be ignored in
this scenario because:
* all boolean parameters of `getValidMaterializedViews` is false
* We pull the MVs from the registry so all of them must exists in the
registry
In case of multiple HS2 instances the registry may not contains all the
possible MVs for rewrite but we initiate the lookup using the registry.
I would extend this sql text based rewrite functionality to able to lookup
from the metastore in a follow up patch.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]