vineetgarg02 commented on a change in pull request #1471:
URL: https://github.com/apache/hive/pull/1471#discussion_r485929257



##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/views/HiveMaterializedViewUtils.java
##########
@@ -347,6 +355,38 @@ public static RelNode copyNodeNewCluster(RelOptCluster 
optCluster, RelNode node)
     }
   }
 
+  /**
+   * Validate if given materialized view has SELECT privileges for current user
+   * @param cachedMVTable
+   * @return false if user does not have privilege otherwise true
+   * @throws HiveException
+   */
+  public static boolean checkPrivilegeForMV(List<Table> cachedMVTableList) 
throws HiveException {

Review comment:
       Done

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
##########
@@ -2280,6 +2280,15 @@ private RelNode 
applyMaterializedViewRewriting(RelOptPlanner planner, RelNode ba
         return calcitePreMVRewritingPlan;
       }
 
+      try {
+        if 
(!HiveMaterializedViewUtils.checkPrivilegeForMV(materializedViewsUsedAfterRewrite))
 {
+          // if materialized views do not have appropriate privilges, we 
shouldn't be using them

Review comment:
       Fixed




----------------------------------------------------------------
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]

Reply via email to