hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1529195 - in /hive/trunk: ql/src/java/org/apache/hadoop/hive/ql/ ql/src/java/org/apache/hadoop/hive/ql/parse/ service/src/java/org/apache/hive/service/cli/operation/
Date Fri, 04 Oct 2013 15:41:57 GMT
Author: brock
Date: Fri Oct  4 15:41:56 2013
New Revision: 1529195

URL: http://svn.apache.org/r1529195
Log:
HIVE-4669 - Make username available to semantic analyzer hooks (Shreepadma Venugopalan via
Brock Noland)

Modified:
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContext.java
    hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContextImpl.java
    hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java?rev=1529195&r1=1529194&r2=1529195&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/Driver.java Fri Oct  4 15:41:56 2013
@@ -1,3 +1,4 @@
+
 /**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -137,6 +138,8 @@ public class Driver implements CommandPr
   private static final int SLEEP_TIME = 2000;
   protected int tryCount = Integer.MAX_VALUE;
 
+  private String userName;
+
   private boolean checkLockManager() {
     boolean supportConcurrency = conf.getBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY);
     if (!supportConcurrency) {
@@ -326,6 +329,11 @@ public class Driver implements CommandPr
   public Driver(HiveConf conf) {
     this.conf = conf;
   }
+  
+  public Driver(HiveConf conf, String userName) {
+    this(conf);
+    this.userName = userName;
+  }
 
   public Driver() {
     if (SessionState.get() != null) {
@@ -436,6 +444,7 @@ public class Driver implements CommandPr
       if (saHooks != null) {
         HiveSemanticAnalyzerHookContext hookCtx = new HiveSemanticAnalyzerHookContextImpl();
         hookCtx.setConf(conf);
+        hookCtx.setUserName(userName);
         for (HiveSemanticAnalyzerHook hook : saHooks) {
           tree = hook.preAnalyze(hookCtx, tree);
         }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContext.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContext.java?rev=1529195&r1=1529194&r2=1529195&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContext.java
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContext.java
Fri Oct  4 15:41:56 2013
@@ -53,4 +53,8 @@ public interface HiveSemanticAnalyzerHoo
   public Set<ReadEntity> getInputs();
 
   public Set<WriteEntity> getOutputs();
+
+  public String getUserName();
+
+  public void setUserName(String userName);
 }

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContextImpl.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContextImpl.java?rev=1529195&r1=1529194&r2=1529195&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContextImpl.java
(original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveSemanticAnalyzerHookContextImpl.java
Fri Oct  4 15:41:56 2013
@@ -32,6 +32,7 @@ public class HiveSemanticAnalyzerHookCon
   Configuration conf;
   Set<ReadEntity> inputs = null;
   Set<WriteEntity> outputs = null;
+  private String userName;
 
   @Override
   public Hive getHive() throws HiveException {
@@ -64,4 +65,12 @@ public class HiveSemanticAnalyzerHookCon
   public Set<WriteEntity> getOutputs() {
     return outputs;
   }
+
+  public String getUserName() {
+    return userName;
+  }
+
+  public void setUserName(String userName) {
+    this.userName = userName;
+  }
 }

Modified: hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1529195&r1=1529194&r2=1529195&view=diff
==============================================================================
--- hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/trunk/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Fri
Oct  4 15:41:56 2013
@@ -91,7 +91,7 @@ public class SQLOperation extends Execut
     String SQLState = null;
 
     try {
-      driver = new Driver(getParentSession().getHiveConf());
+      driver = new Driver(getParentSession().getHiveConf(), getParentSession().getUserName());
       // In Hive server mode, we are not able to retry in the FetchTask
       // case, when calling fetch queries since execute() has returned.
       // For now, we disable the test attempts.



Mime
View raw message