Search in sources :

Example 21 with FieldReader

use of org.apache.drill.exec.vector.complex.reader.FieldReader in project drill by axbaretto.

the class RepeatedMapReaderImpl method reader.

@Override
public FieldReader reader(String name) {
    FieldReader reader = fields.get(name);
    if (reader == null) {
        ValueVector child = vector.getChild(name);
        if (child == null) {
            reader = NullReader.INSTANCE;
        } else {
            reader = child.getReader();
        }
        fields.put(name, reader);
        reader.setPosition(currentOffset);
    }
    return reader;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) FieldReader(org.apache.drill.exec.vector.complex.reader.FieldReader)

Example 22 with FieldReader

use of org.apache.drill.exec.vector.complex.reader.FieldReader in project drill by apache.

the class ListVector method copyFrom.

public void copyFrom(int inIndex, int outIndex, ListVector from) {
    final FieldReader in = from.getReader();
    in.setPosition(inIndex);
    final FieldWriter out = getWriter();
    out.setPosition(outIndex);
    ComplexCopier.copy(in, out);
}
Also used : FieldReader(org.apache.drill.exec.vector.complex.reader.FieldReader) FieldWriter(org.apache.drill.exec.vector.complex.writer.FieldWriter)

Example 23 with FieldReader

use of org.apache.drill.exec.vector.complex.reader.FieldReader in project drill by apache.

the class AbstractRepeatedMapReaderImpl method reset.

@Override
public void reset() {
    super.reset();
    currentOffset = 0;
    maxOffset = 0;
    for (FieldReader reader : fields.values()) {
        reader.reset();
    }
    fields.clear();
}
Also used : FieldReader(org.apache.drill.exec.vector.complex.reader.FieldReader)

Example 24 with FieldReader

use of org.apache.drill.exec.vector.complex.reader.FieldReader in project drill by apache.

the class SingleDictReaderImpl method read.

@Override
public void read(Object key, ValueHolder holder) {
    if (isEmpty()) {
        return;
    }
    int index = find(key);
    FieldReader valueReader = reader(DictVector.FIELD_VALUE_NAME);
    valueReader.setPosition(index);
    if (index != NOT_FOUND) {
        valueReader.read(holder);
    }
}
Also used : FieldReader(org.apache.drill.exec.vector.complex.reader.FieldReader)

Example 25 with FieldReader

use of org.apache.drill.exec.vector.complex.reader.FieldReader in project drill by apache.

the class SingleMapReaderImpl method reader.

@Override
public FieldReader reader(String name) {
    FieldReader reader = fields.get(name);
    if (reader == null) {
        ValueVector child = vector.getChild(name);
        if (child == null) {
            reader = NullReader.INSTANCE;
        } else {
            reader = child.getReader();
        }
        fields.put(name, reader);
        reader.setPosition(idx());
    }
    return reader;
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) FieldReader(org.apache.drill.exec.vector.complex.reader.FieldReader)

Aggregations

FieldReader (org.apache.drill.exec.vector.complex.reader.FieldReader)30 Test (org.junit.Test)8 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)6 SingleMapReaderImpl (org.apache.drill.exec.vector.complex.impl.SingleMapReaderImpl)6 BaseWriter (org.apache.drill.exec.vector.complex.writer.BaseWriter)6 BsonDocument (org.bson.BsonDocument)6 BsonDocumentReader (org.bson.BsonDocumentReader)6 ValueVector (org.apache.drill.exec.vector.ValueVector)5 VarCharHolder (org.apache.drill.exec.expr.holders.VarCharHolder)4 BaseTest (org.apache.drill.test.BaseTest)4 BsonDocumentWriter (org.bson.BsonDocumentWriter)4 BsonWriter (org.bson.BsonWriter)4 DataMode (org.apache.drill.common.types.TypeProtos.DataMode)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Annotation (java.lang.annotation.Annotation)2 Inject (javax.inject.Inject)2 FieldDescriptor (org.apache.drill.common.scanner.persistence.FieldDescriptor)2 MajorType (org.apache.drill.common.types.TypeProtos.MajorType)2