You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2020/04/16 17:12:00 UTC

[hive] branch master updated: HIVE-23212 : SemanticAnalyzer::getStagingDirectoryPathname should check for encryption zone only when needed (Rajesh Balamohan via Gopal V)

This is an automated email from the ASF dual-hosted git repository.

hashutosh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 661e40a  HIVE-23212 : SemanticAnalyzer::getStagingDirectoryPathname should check for encryption zone only when needed (Rajesh Balamohan via Gopal V)
661e40a is described below

commit 661e40a26e1b8a79224cf686e0242a2b2dbf1219
Author: Rajesh Balamohan <rb...@apache.org>
AuthorDate: Thu Apr 16 10:06:55 2020 -0700

    HIVE-23212 : SemanticAnalyzer::getStagingDirectoryPathname should check for encryption zone only when needed (Rajesh Balamohan via Gopal V)
    
    Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
---
 .../org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
index c87f2d2..e13dfe8 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
@@ -68,6 +68,7 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.hdfs.DFSUtilClient;
 import org.apache.hadoop.hive.common.FileUtils;
 import org.apache.hadoop.hive.common.StatsSetupConst;
 import org.apache.hadoop.hive.common.StatsSetupConst.StatDB;
@@ -2565,11 +2566,13 @@ public class SemanticAnalyzer extends BaseSemanticAnalyzer {
    * @throws HiveException If an error occurs while identifying the correct staging location.
    */
   private Path getStagingDirectoryPathname(QB qb) throws HiveException {
-    Path stagingPath = null, tablePath;
+    Path stagingPath = null, tablePath = null;
 
-    // Looks for the most encrypted table location
-    // It may return null if there are not tables encrypted, or are not part of HDFS
-    tablePath = getStrongestEncryptedTablePath(qb);
+    if (DFSUtilClient.isHDFSEncryptionEnabled(conf)) {
+      // Looks for the most encrypted table location
+      // It may return null if there are not tables encrypted, or are not part of HDFS
+      tablePath = getStrongestEncryptedTablePath(qb);
+    }
     if (tablePath != null) {
       // At this point, tablePath is part of HDFS and it is encrypted
       if (isPathReadOnly(tablePath)) {