You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ss...@apache.org on 2015/10/07 03:20:25 UTC

hive git commit: HIVE-12043. Fix UGI usage in IO elevator threads. (Siddharth Seth)

Repository: hive
Updated Branches:
  refs/heads/llap b87f63cad -> b861b9efb


HIVE-12043. Fix UGI usage in IO elevator threads. (Siddharth Seth)


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

Branch: refs/heads/llap
Commit: b861b9efbd516d596414e7b68d746c905472b225
Parents: b87f63c
Author: Siddharth Seth <ss...@apache.org>
Authored: Tue Oct 6 18:19:54 2015 -0700
Committer: Siddharth Seth <ss...@apache.org>
Committed: Tue Oct 6 18:19:54 2015 -0700

----------------------------------------------------------------------
 .../llap/io/encoded/OrcEncodedDataReader.java   | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/b861b9ef/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java
----------------------------------------------------------------------
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java b/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java
index c934f39..33277ae 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java
@@ -2,6 +2,7 @@ package org.apache.hadoop.hive.llap.io.encoded;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -61,6 +62,7 @@ import org.apache.hadoop.hive.ql.io.orc.StripeInformation;
 import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
 import org.apache.hadoop.mapred.FileSplit;
 import org.apache.hadoop.mapred.InputSplit;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hive.common.util.FixedSizedObjectPool;
 
 /**
@@ -121,6 +123,7 @@ public class OrcEncodedDataReader extends CallableWithNdc<Void>
   private final String[] columnNames;
   private final OrcEncodedDataConsumer consumer;
   private final QueryFragmentCounters counters;
+  private final UserGroupInformation ugi;
 
   // Read state.
   private int stripeIxFrom;
@@ -156,6 +159,11 @@ public class OrcEncodedDataReader extends CallableWithNdc<Void>
     this.columnNames = columnNames;
     this.consumer = consumer;
     this.counters = counters;
+    try {
+      this.ugi = UserGroupInformation.getCurrentUser();
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
   }
 
   @Override
@@ -179,7 +187,16 @@ public class OrcEncodedDataReader extends CallableWithNdc<Void>
   }
 
   @Override
-  protected Void callInternal() throws IOException {
+  protected Void callInternal() throws IOException, InterruptedException {
+    return ugi.doAs(new PrivilegedExceptionAction<Void>() {
+      @Override
+      public Void run() throws Exception {
+        return performDataRead();
+      }
+    });
+  }
+
+  protected Void performDataRead() throws IOException {
     long startTime = counters.startTimeCounter();
     if (LlapIoImpl.LOGL.isInfoEnabled()) {
       LlapIoImpl.LOG.info("Processing data for " + split.getPath());
@@ -653,7 +670,6 @@ public class OrcEncodedDataReader extends CallableWithNdc<Void>
   /**
    * Determines which RGs need to be read, after stripes have been determined.
    * SARG is applied, and readState is populated for each stripe accordingly.
-   * @param stripes All stripes in the file (field state is used to determine stripes to read).
    */
   private boolean determineRgsToRead(boolean[] globalIncludes, int rowIndexStride,
       ArrayList<OrcStripeMetadata> metadata) throws IOException {