cgivre commented on a change in pull request #1962: URL: https://github.com/apache/drill/pull/1962#discussion_r418241154
########## File path: contrib/format-ltsv/src/main/java/org/apache/drill/exec/store/ltsv/LTSVFormatPlugin.java ########## @@ -15,78 +15,77 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.drill.exec.store.ltsv; -import org.apache.drill.common.expression.SchemaPath; import org.apache.drill.common.logical.StoragePluginConfig; -import org.apache.drill.exec.ops.FragmentContext; -import org.apache.drill.exec.planner.common.DrillStatsTable.TableStatistics; +import org.apache.drill.common.types.TypeProtos; +import org.apache.drill.common.types.Types; +import org.apache.drill.exec.physical.impl.scan.file.FileScanFramework.FileSchemaNegotiator; +import org.apache.drill.exec.physical.impl.scan.file.FileScanFramework.FileReaderFactory; +import org.apache.drill.exec.physical.impl.scan.file.FileScanFramework.FileScanBuilder; +import org.apache.drill.exec.physical.impl.scan.framework.ManagedReader; import org.apache.drill.exec.proto.UserBitShared; import org.apache.drill.exec.server.DrillbitContext; -import org.apache.drill.exec.store.RecordReader; -import org.apache.drill.exec.store.RecordWriter; -import org.apache.drill.exec.store.dfs.DrillFileSystem; +import org.apache.drill.exec.server.options.OptionManager; import org.apache.drill.exec.store.dfs.easy.EasyFormatPlugin; -import org.apache.drill.exec.store.dfs.easy.EasyWriter; -import org.apache.drill.exec.store.dfs.easy.FileWork; +import org.apache.drill.exec.store.dfs.easy.EasySubScan; +import org.apache.drill.shaded.guava.com.google.common.collect.Lists; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; - -import java.util.List; +/** + * Enables Drill to query data in Labeled Tab Separated Values (LTSV) format. + * <a href="http://ltsv.org" target="_blank">LTSV Spec</a> + */ public class LTSVFormatPlugin extends EasyFormatPlugin<LTSVFormatPluginConfig> { - private static final boolean IS_COMPRESSIBLE = true; - private static final String DEFAULT_NAME = "ltsv"; - public LTSVFormatPlugin(String name, DrillbitContext context, Configuration fsConf, StoragePluginConfig storageConfig) { - this(name, context, fsConf, storageConfig, new LTSVFormatPluginConfig(null)); - } + public static class LTSVReaderFactory extends FileReaderFactory { + private final LTSVFormatPluginConfig config; - public LTSVFormatPlugin(String name, DrillbitContext context, Configuration fsConf, StoragePluginConfig config, LTSVFormatPluginConfig formatPluginConfig) { - super(name, context, fsConf, config, formatPluginConfig, true, false, false, IS_COMPRESSIBLE, formatPluginConfig.getExtensions(), DEFAULT_NAME); - } + public LTSVReaderFactory(LTSVFormatPluginConfig config) { + this.config = config; + } - @Override - public RecordReader getRecordReader(FragmentContext context, DrillFileSystem dfs, FileWork fileWork, List<SchemaPath> columns, String userName) { - return new LTSVRecordReader(context, fileWork.getPath(), dfs, columns); + @Override + public ManagedReader<? extends FileSchemaNegotiator> newReader() { + return new LTSVBatchReader(); Review comment: fixed ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
