use of org.apache.drill.exec.physical.resultSet.ResultSetLoader in project drill by apache.
the class SasBatchReader method open.
@Override
public boolean open(FileScanFramework.FileSchemaNegotiator negotiator) {
split = negotiator.split();
errorContext = negotiator.parentErrorContext();
openFile(negotiator);
TupleMetadata schema;
if (negotiator.hasProvidedSchema()) {
schema = negotiator.providedSchema();
} else {
schema = buildSchema();
}
schema = addImplicitColumnsToSchema(schema);
negotiator.tableSchema(schema, true);
ResultSetLoader loader = negotiator.build();
rowWriter = loader.writer();
buildWriterList(schema);
return true;
}
use of org.apache.drill.exec.physical.resultSet.ResultSetLoader in project drill by apache.
the class SpssBatchReader method open.
@Override
public boolean open(FileSchemaNegotiator negotiator) {
split = negotiator.split();
openFile(negotiator);
negotiator.tableSchema(buildSchema(), true);
errorContext = negotiator.parentErrorContext();
ResultSetLoader loader = negotiator.build();
rowWriter = loader.writer();
buildReaderList();
return true;
}
use of org.apache.drill.exec.physical.resultSet.ResultSetLoader in project drill by apache.
the class SyslogBatchReader method open.
@Override
public boolean open(FileSchemaNegotiator negotiator) {
split = negotiator.split();
openFile(negotiator);
negotiator.tableSchema(buildSchema(), false);
errorContext = negotiator.parentErrorContext();
ResultSetLoader loader = negotiator.build();
rowWriter = loader.writer();
writerArray = populateRowWriters();
rawColumnWriter = rowWriter.scalar(RAW_COLUMN_NAME);
messageWriter = rowWriter.scalar("message");
return true;
}
use of org.apache.drill.exec.physical.resultSet.ResultSetLoader in project drill by apache.
the class HttpdLogBatchReader method open.
@Override
public boolean open(FileSchemaNegotiator negotiator) {
// Open the input stream to the log file
openFile(negotiator);
errorContext = negotiator.parentErrorContext();
try {
parser = new HttpdParser(formatConfig.getLogFormat(), formatConfig.getTimestampFormat(), formatConfig.getFlattenWildcards(), formatConfig.getParseUserAgent(), formatConfig.getLogParserRemapping(), scan);
negotiator.tableSchema(parser.setupParser(), false);
} catch (Exception e) {
throw UserException.dataReadError(e).message("Error opening HTTPD file: " + e.getMessage()).addContext(errorContext).build(logger);
}
ResultSetLoader loader = negotiator.build();
rowWriter = loader.writer();
parser.addFieldsToParser(rowWriter);
rawLineWriter = addImplicitColumn(RAW_LINE_COL_NAME, MinorType.VARCHAR);
matchedWriter = addImplicitColumn(MATCHED_COL_NAME, MinorType.BIT);
return true;
}
use of org.apache.drill.exec.physical.resultSet.ResultSetLoader in project drill by apache.
the class ImageBatchReader method open.
@Override
public boolean open(FileSchemaNegotiator negotiator) {
try {
errorContext = negotiator.parentErrorContext();
DrillFileSystem dfs = negotiator.fileSystem();
path = dfs.makeQualified(negotiator.split().getPath());
fileStatus = dfs.getFileStatus(path);
metaInputStream = new BufferedInputStream(dfs.openPossiblyCompressedStream(path));
logger.debug("The config is {}, root is {}, columns has {}", config, scan.getSelectionRoot(), scan.getColumns());
} catch (IOException e) {
throw UserException.dataReadError(e).message("Failure in initial image inputstream. " + e.getMessage()).addContext(errorContext).build(logger);
}
// define the schema
negotiator.tableSchema(defineMetadata(), false);
ResultSetLoader resultSetLoader = negotiator.build();
loader = resultSetLoader.writer();
// bind the writer for generic columns
bindColumns(loader);
return true;
}
Aggregations