You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by vi...@apache.org on 2019/03/24 23:34:31 UTC

[drill] 04/05: DRILL-7079: Drill can't query views from the S3 storage when plain authentication is enabled

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

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

commit bd374345cf11642857b702ceba660580f3cf4af5
Author: Bohdan Kazydub <bo...@gmail.com>
AuthorDate: Thu Mar 21 10:52:14 2019 +0200

    DRILL-7079: Drill can't query views from the S3 storage when plain authentication is enabled
    
    closes #1712
---
 .../main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java    | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
index 04b0d74..761d4ac 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/dotdrill/DotDrillFile.java
@@ -19,6 +19,7 @@ package org.apache.drill.exec.dotdrill;
 
 import org.apache.drill.common.config.LogicalPlanPersistence;
 import org.apache.drill.exec.store.dfs.DrillFileSystem;
+import org.apache.drill.exec.util.ImpersonationUtil;
 import org.apache.hadoop.fs.FileStatus;
 
 import org.apache.drill.shaded.guava.com.google.common.base.Preconditions;
@@ -55,6 +56,13 @@ public class DotDrillFile {
    * @return Return owner of the file in underlying file system.
    */
   public String getOwner() {
+    if (type == DotDrillType.VIEW && status.getOwner().isEmpty()) {
+      // Drill view S3AFileStatus is not populated with owner (it has default value of "").
+      // This empty String causes IllegalArgumentException to be thrown (if impersonation is enabled) in
+      // SchemaTreeProvider#createRootSchema(String, SchemaConfigInfoProvider). To work-around the issue
+      // we can return current user as if they were the owner of the file (since they have access to it).
+      return ImpersonationUtil.getProcessUserName();
+    }
     return status.getOwner();
   }