Search in sources :

Example 1 with VectorContainerWriter

use of org.apache.drill.exec.vector.complex.impl.VectorContainerWriter in project drill by axbaretto.

the class MaprDBJsonRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    this.vectorWriter = new VectorContainerWriter(output, unionEnabled);
    this.operatorContext = context;
    try {
        table = MapRDB.getTable(tableName);
        table.setOption(TableOption.EXCLUDEID, !includeId);
        documentStream = table.find(condition, projectedFields);
        documentReaderIterators = documentStream.documentReaders().iterator();
    } catch (DBException e) {
        throw new ExecutionSetupException(e);
    }
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) DBException(com.mapr.db.exceptions.DBException) VectorContainerWriter(org.apache.drill.exec.vector.complex.impl.VectorContainerWriter)

Example 2 with VectorContainerWriter

use of org.apache.drill.exec.vector.complex.impl.VectorContainerWriter in project drill by axbaretto.

the class MongoRecordReader method setup.

@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
    this.writer = new VectorContainerWriter(output, unionEnabled);
    // BsonRecordReader
    if (isBsonRecordReader) {
        this.bsonReader = new BsonRecordReader(fragmentContext.getManagedBuffer(), Lists.newArrayList(getColumns()), readNumbersAsDouble);
        logger.debug("Initialized BsonRecordReader. ");
    } else {
        this.jsonReader = new JsonReader.Builder(fragmentContext.getManagedBuffer()).schemaPathColumns(Lists.newArrayList(getColumns())).allTextMode(enableAllTextMode).readNumbersAsDouble(readNumbersAsDouble).enableNanInf(enableNanInf).build();
        logger.debug(" Intialized JsonRecordReader. ");
    }
}
Also used : BsonRecordReader(org.apache.drill.exec.store.bson.BsonRecordReader) VectorContainerWriter(org.apache.drill.exec.vector.complex.impl.VectorContainerWriter)

Example 3 with VectorContainerWriter

use of org.apache.drill.exec.vector.complex.impl.VectorContainerWriter in project drill by axbaretto.

the class AvroRecordReader method setup.

@Override
public void setup(final OperatorContext context, final OutputMutator output) throws ExecutionSetupException {
    writer = new VectorContainerWriter(output);
    try {
        reader = getReader(hadoop, fs);
        logger.debug("Processing file : {}, start position : {}, end position : {} ", hadoop, start, end);
        reader.sync(this.start);
    } catch (IOException e) {
        throw new ExecutionSetupException(e);
    }
}
Also used : ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) VectorContainerWriter(org.apache.drill.exec.vector.complex.impl.VectorContainerWriter) IOException(java.io.IOException)

Example 4 with VectorContainerWriter

use of org.apache.drill.exec.vector.complex.impl.VectorContainerWriter in project drill by axbaretto.

the class JSONRecordReader method setup.

@Override
public void setup(final OperatorContext context, final OutputMutator output) throws ExecutionSetupException {
    try {
        if (hadoopPath != null) {
            this.stream = fileSystem.openPossiblyCompressedStream(hadoopPath);
        }
        this.writer = new VectorContainerWriter(output, unionEnabled);
        if (isSkipQuery()) {
            this.jsonReader = new CountingJsonReader(fragmentContext.getManagedBuffer(), enableNanInf);
        } else {
            this.jsonReader = new JsonReader.Builder(fragmentContext.getManagedBuffer()).schemaPathColumns(ImmutableList.copyOf(getColumns())).allTextMode(enableAllTextMode).skipOuterList(true).readNumbersAsDouble(readNumbersAsDouble).enableNanInf(enableNanInf).build();
        }
        setupParser();
    } catch (final Exception e) {
        handleAndRaise("Failure reading JSON file", e);
    }
}
Also used : VectorContainerWriter(org.apache.drill.exec.vector.complex.impl.VectorContainerWriter) CountingJsonReader(org.apache.drill.exec.store.easy.json.reader.CountingJsonReader) JsonReader(org.apache.drill.exec.vector.complex.fn.JsonReader) CountingJsonReader(org.apache.drill.exec.store.easy.json.reader.CountingJsonReader) UserException(org.apache.drill.common.exceptions.UserException) IOException(java.io.IOException) OutOfMemoryException(org.apache.drill.exec.exception.OutOfMemoryException) ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 5 with VectorContainerWriter

use of org.apache.drill.exec.vector.complex.impl.VectorContainerWriter in project drill by axbaretto.

the class TestBsonRecordReader method setUp.

@BeforeClass
public static void setUp() {
    BufferAllocator bufferAllocator = getDrillbitContext().getAllocator();
    mutator = new TestOutputMutator(bufferAllocator);
    writer = new VectorContainerWriter(mutator);
    bsonReader = new BsonRecordReader(bufferAllocator.buffer(1024), false, false);
}
Also used : VectorContainerWriter(org.apache.drill.exec.vector.complex.impl.VectorContainerWriter) TestOutputMutator(org.apache.drill.exec.store.TestOutputMutator) BufferAllocator(org.apache.drill.exec.memory.BufferAllocator) BeforeClass(org.junit.BeforeClass)

Aggregations

VectorContainerWriter (org.apache.drill.exec.vector.complex.impl.VectorContainerWriter)16 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)6 IOException (java.io.IOException)4 TestOutputMutator (org.apache.drill.exec.store.TestOutputMutator)4 UserException (org.apache.drill.common.exceptions.UserException)3 BufferAllocator (org.apache.drill.exec.memory.BufferAllocator)3 Test (org.junit.Test)3 JsonParseException (com.fasterxml.jackson.core.JsonParseException)2 DBException (com.mapr.db.exceptions.DBException)2 OutOfMemoryException (org.apache.drill.exec.exception.OutOfMemoryException)2 BsonRecordReader (org.apache.drill.exec.store.bson.BsonRecordReader)2 CountingJsonReader (org.apache.drill.exec.store.easy.json.reader.CountingJsonReader)2 ComplexWriter (org.apache.drill.exec.vector.complex.writer.BaseWriter.ComplexWriter)2 MapWriter (org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter)2 DBDocumentReaderBase (com.mapr.db.ojai.DBDocumentReaderBase)1 DrillBuf (io.netty.buffer.DrillBuf)1 SchemaChangeException (org.apache.drill.exec.exception.SchemaChangeException)1 RootAllocator (org.apache.drill.exec.memory.RootAllocator)1 BufferManagerImpl (org.apache.drill.exec.ops.BufferManagerImpl)1 OperatorContext (org.apache.drill.exec.ops.OperatorContext)1