Search in sources :

Example 1 with SequenceFileAsBinaryInputFormat

use of org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat in project drill by apache.

the class SequenceFileRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    final SequenceFileAsBinaryInputFormat inputFormat = new SequenceFileAsBinaryInputFormat();
    final JobConf jobConf = new JobConf(dfs.getConf());
    jobConf.setInputFormat(inputFormat.getClass());
    reader = getRecordReader(inputFormat, jobConf);
    final MaterializedField keyField = MaterializedField.create(keySchema, KEY_TYPE);
    final MaterializedField valueField = MaterializedField.create(valueSchema, VALUE_TYPE);
    try {
        keyVector = output.addField(keyField, NullableVarBinaryVector.class);
        valueVector = output.addField(valueField, NullableVarBinaryVector.class);
    } catch (SchemaChangeException sce) {
        throw new ExecutionSetupException("Error in setting up sequencefile reader.", sce);
    }
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) SchemaChangeException(org.apache.drill.exec.exception.SchemaChangeException) NullableVarBinaryVector(org.apache.drill.exec.vector.NullableVarBinaryVector) SequenceFileAsBinaryInputFormat(org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat) MaterializedField(org.apache.drill.exec.record.MaterializedField) JobConf(org.apache.hadoop.mapred.JobConf)

Example 2 with SequenceFileAsBinaryInputFormat

use of org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat in project drill by axbaretto.

the class SequenceFileRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    final SequenceFileAsBinaryInputFormat inputFormat = new SequenceFileAsBinaryInputFormat();
    final JobConf jobConf = new JobConf(dfs.getConf());
    jobConf.setInputFormat(inputFormat.getClass());
    reader = getRecordReader(inputFormat, jobConf);
    final MaterializedField keyField = MaterializedField.create(keySchema, KEY_TYPE);
    final MaterializedField valueField = MaterializedField.create(valueSchema, VALUE_TYPE);
    try {
        keyVector = output.addField(keyField, NullableVarBinaryVector.class);
        valueVector = output.addField(valueField, NullableVarBinaryVector.class);
    } catch (SchemaChangeException sce) {
        throw new ExecutionSetupException("Error in setting up sequencefile reader.", sce);
    }
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) SchemaChangeException(org.apache.drill.exec.exception.SchemaChangeException) NullableVarBinaryVector(org.apache.drill.exec.vector.NullableVarBinaryVector) SequenceFileAsBinaryInputFormat(org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat) MaterializedField(org.apache.drill.exec.record.MaterializedField) JobConf(org.apache.hadoop.mapred.JobConf)

Example 3 with SequenceFileAsBinaryInputFormat

use of org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat in project drill by apache.

the class SequenceFileBatchReader method processReader.

private void processReader(FileSchemaNegotiator negotiator) throws ExecutionSetupException {
    final SequenceFileAsBinaryInputFormat inputFormat = new SequenceFileAsBinaryInputFormat();
    split = negotiator.split();
    // After defined the split, We should also define the errorContext.
    errorContext = negotiator.parentErrorContext();
    opUserName = scan.getUserName();
    queryUserName = negotiator.context().getFragmentContext().getQueryUserName();
    final JobConf jobConf = new JobConf(negotiator.fileSystem().getConf());
    jobConf.setInputFormat(inputFormat.getClass());
    reader = getRecordReader(inputFormat, jobConf);
}
Also used : SequenceFileAsBinaryInputFormat(org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat) JobConf(org.apache.hadoop.mapred.JobConf)

Aggregations

JobConf (org.apache.hadoop.mapred.JobConf)3 SequenceFileAsBinaryInputFormat (org.apache.hadoop.mapred.SequenceFileAsBinaryInputFormat)3 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)2 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)2 MaterializedField (org.apache.drill.exec.record.MaterializedField)2 NullableVarBinaryVector (org.apache.drill.exec.vector.NullableVarBinaryVector)2