sentry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject sentry git commit: SENTRY-1190: IMPORT TABLE silently fails if Sentry is enabled(Reuben Kuhnert via Colin Ma)
Date Fri, 22 Apr 2016 06:43:39 GMT
Repository: sentry
Updated Branches:
  refs/heads/master c49ea3a8e -> 89d64b660


SENTRY-1190: IMPORT TABLE silently fails if Sentry is enabled(Reuben Kuhnert via Colin Ma)


Project: http://git-wip-us.apache.org/repos/asf/sentry/repo
Commit: http://git-wip-us.apache.org/repos/asf/sentry/commit/89d64b66
Tree: http://git-wip-us.apache.org/repos/asf/sentry/tree/89d64b66
Diff: http://git-wip-us.apache.org/repos/asf/sentry/diff/89d64b66

Branch: refs/heads/master
Commit: 89d64b6609229c48a250682091ed47c49bf7ffa1
Parents: c49ea3a
Author: Colin Ma <colin@apache.org>
Authored: Fri Apr 22 15:14:41 2016 +0800
Committer: Colin Ma <colin@apache.org>
Committed: Fri Apr 22 15:14:41 2016 +0800

----------------------------------------------------------------------
 .../hive/ql/exec/SentryFilterDDLTask.java       | 23 ++++++++++++++++++++
 .../binding/hive/HiveAuthzBindingHook.java      | 13 ++++++-----
 2 files changed, 31 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sentry/blob/89d64b66/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/hadoop/hive/ql/exec/SentryFilterDDLTask.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/hadoop/hive/ql/exec/SentryFilterDDLTask.java
b/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/hadoop/hive/ql/exec/SentryFilterDDLTask.java
index ca24531..f3799ca 100644
--- a/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/hadoop/hive/ql/exec/SentryFilterDDLTask.java
+++ b/sentry-binding/sentry-binding-hive-common/src/main/java/org/apache/hadoop/hive/ql/exec/SentryFilterDDLTask.java
@@ -134,4 +134,27 @@ public class SentryFilterDDLTask extends DDLTask {
     return HiveAuthzBindingHookBase.filterShowColumns(getHiveAuthzBinding(),
         cols, getStmtOperation(), getSubject().getName(), table.getTableName(), table.getDbName());
   }
+
+  public void copyDDLTask(DDLTask ddlTask) {
+    work = ddlTask.getWork();
+    rootTask = ddlTask.isRootTask();
+    childTasks = ddlTask.getChildTasks();
+    parentTasks = ddlTask.getParentTasks();
+    backupTask = ddlTask.getBackupTask();
+    backupChildrenTasks = ddlTask.getBackupChildrenTasks();
+    started = ddlTask.started();
+    isdone = ddlTask.done();
+    queued = ddlTask.getQueued();
+    id = ddlTask.getId();
+    taskCounters = ddlTask.getCounters();
+    feedSubscribers = ddlTask.getFeedSubscribers();
+    taskTag = ddlTask.getTaskTag();
+    setLocalMode(ddlTask.isLocalMode());
+    setRetryCmdWhenFail(ddlTask.ifRetryCmdWhenFail());
+    queryPlan = ddlTask.getQueryPlan();
+    jobID = ddlTask.getJobID();
+    setException(ddlTask.getException());
+    console = ddlTask.console;
+    setFetchSource(ddlTask.isFetchSource());
+  }
 }

http://git-wip-us.apache.org/repos/asf/sentry/blob/89d64b66/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
----------------------------------------------------------------------
diff --git a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
index d752b25..57fc1e4 100644
--- a/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
+++ b/sentry-binding/sentry-binding-hive/src/main/java/org/apache/sentry/binding/hive/HiveAuthzBindingHook.java
@@ -36,8 +36,8 @@ import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
 import org.apache.hadoop.hive.ql.parse.HiveParser;
 import org.apache.hadoop.hive.ql.parse.HiveSemanticAnalyzerHookContext;
 import org.apache.hadoop.hive.ql.parse.SemanticException;
-import org.apache.hadoop.hive.ql.plan.DDLWork;
 import org.apache.hadoop.hive.ql.plan.HiveOperation;
+import org.apache.hadoop.hive.ql.plan.ShowColumnsDesc;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.sentry.binding.hive.authz.HiveAuthzPrivileges;
 import org.apache.sentry.binding.hive.authz.HiveAuthzPrivilegesMap;
@@ -305,10 +305,13 @@ public class HiveAuthzBindingHook extends HiveAuthzBindingHookBase {
       for (int i = 0; i < rootTasks.size(); i++) {
         Task<? extends Serializable> task = rootTasks.get(i);
         if (task instanceof DDLTask) {
-          SentryFilterDDLTask filterTask =
-              new SentryFilterDDLTask(hiveAuthzBinding, subject, stmtOperation);
-          filterTask.setWork((DDLWork)task.getWork());
-          rootTasks.set(i, filterTask);
+          ShowColumnsDesc showCols = ((DDLTask) task).getWork().getShowColumnsDesc();
+          if (showCols != null) {
+            SentryFilterDDLTask filterTask =
+                    new SentryFilterDDLTask(hiveAuthzBinding, subject, stmtOperation);
+            filterTask.copyDDLTask((DDLTask) task);
+            rootTasks.set(i, filterTask);
+          }
         }
       }
 


Mime
View raw message