diff --git llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java index 3fcf0dc..e154dc3 100644 --- llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java +++ llap-server/src/java/org/apache/hadoop/hive/llap/io/encoded/OrcEncodedDataReader.java @@ -526,7 +526,7 @@ private void ensureOrcReader() throws IOException { } LlapIoImpl.ORC_LOGGER.trace("Creating reader for {} ({})", path, split.getPath()); long startTime = counters.startTimeCounter(); - ReaderOptions opts = OrcFile.readerOptions(jobConf).filesystem(fsSupplier.get()).fileMetadata(fileMetadata); + ReaderOptions opts = EncodedOrcFile.readerOptions(jobConf).filesystem(fsSupplier).fileMetadata(fileMetadata); if (split instanceof OrcSplit) { OrcTail orcTail = ((OrcSplit) split).getOrcTail(); if (orcTail != null) { diff --git ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedOrcFile.java ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedOrcFile.java index 97a1b53..c49c083 100644 --- ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedOrcFile.java +++ ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedOrcFile.java @@ -19,12 +19,49 @@ import java.io.IOException; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hive.ql.exec.Utilities.SupplierWithCheckedException; import org.apache.hadoop.hive.ql.io.orc.OrcFile.ReaderOptions; public class EncodedOrcFile { + + public static class EncodedReaderOptions extends ReaderOptions { + + private SupplierWithCheckedException filesystemSupplier; + + public EncodedReaderOptions(Configuration conf) { + super(conf); + } + + public ReaderOptions filesystem(SupplierWithCheckedException fsSupplier) { + this.filesystemSupplier = fsSupplier; + return this; + } + + @Override + public ReaderOptions filesystem(FileSystem fs) { + this.filesystemSupplier = () -> fs; + return this; + } + + public FileSystem getFilesystem() { + try { + return (filesystemSupplier != null) ? filesystemSupplier.get() : null; + } catch (IOException ioe) { + // fall back to null + return null; + } + } + } + public static Reader createReader( Path path, ReaderOptions options) throws IOException { return new ReaderImpl(path, options); } + + public static EncodedReaderOptions readerOptions(Configuration conf) { + return new EncodedReaderOptions(conf); + } }