Skip to content

Commit

Permalink
[trinodb#55] Fix Impersonation When Accessing to Alluxio
Browse files Browse the repository at this point in the history
  • Loading branch information
yangjinde authored and fengguangyuan committed Mar 9, 2022
1 parent 8825f29 commit db07d7b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import io.trino.plugin.hive.HdfsEnvironment.HdfsContext;
import io.trino.spi.TrinoException;
import io.trino.spi.security.ConnectorIdentity;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.iceberg.hadoop.HadoopInputFile;
import org.apache.iceberg.io.InputFile;
Expand All @@ -41,7 +43,10 @@ public HdfsInputFile(Path path, HdfsEnvironment environment, HdfsContext context
this.environment = requireNonNull(environment, "environment is null");
requireNonNull(context, "context is null");
try {
this.delegate = HadoopInputFile.fromPath(path, environment.getFileSystem(context, path), environment.getConfiguration(context, path));
FileSystem fileSystem = environment.getFileSystem(context, path);
Configuration configuration = environment.getConfiguration(context, path);
this.delegate = environment.doAs(context.getIdentity(),
() -> HadoopInputFile.fromPath(path, fileSystem, configuration));
}
catch (IOException e) {
throw new TrinoException(ICEBERG_FILESYSTEM_ERROR, "Failed to create input file: " + path, e);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,7 @@
<dependency>
<groupId>org.alluxio</groupId>
<artifactId>alluxio-shaded-client</artifactId>
<version>2.6.2</version>
<version>2.7.1</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
Expand Down

0 comments on commit db07d7b

Please sign in to comment.