You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/09/09 21:22:12 UTC

[GitHub] [hive] vineetgarg02 commented on a change in pull request #1471: HIVE-23454 : Querying hive table which has Materialized view fails with HiveAccessControlException

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org