Search in sources :

Example 1 with AbstractColumnReader

use of org.apache.drill.exec.vector.accessor.impl.AbstractColumnReader in project drill by apache.

the class AbstractSingleRowSet method buildReader.

/**
   * Internal method to build the set of column readers needed for
   * this row set. Used when building a row set reader.
   * @param rowIndex object that points to the current row
   * @return an array of column readers: in the same order as the
   * (non-map) vectors.
   */
protected RowSetReader buildReader(RowSetIndex rowIndex) {
    FlattenedSchema accessSchema = schema().flatAccess();
    ValueVector[] valueVectors = vectors();
    AbstractColumnReader[] readers = new AbstractColumnReader[valueVectors.length];
    for (int i = 0; i < readers.length; i++) {
        MinorType type = accessSchema.column(i).getType().getMinorType();
        if (type == MinorType.MAP) {
            // buildMapAccessor(i);
            readers[i] = null;
        } else if (type == MinorType.LIST) {
            // buildListAccessor(i);
            readers[i] = null;
        } else {
            readers[i] = ColumnAccessorFactory.newReader(valueVectors[i].getField().getType());
            readers[i].bind(rowIndex, valueVectors[i]);
        }
    }
    return new RowSetReaderImpl(accessSchema, rowIndex, readers);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) FlattenedSchema(org.apache.drill.test.rowSet.RowSetSchema.FlattenedSchema) MinorType(org.apache.drill.common.types.TypeProtos.MinorType) AbstractColumnReader(org.apache.drill.exec.vector.accessor.impl.AbstractColumnReader)

Example 2 with AbstractColumnReader

use of org.apache.drill.exec.vector.accessor.impl.AbstractColumnReader in project drill by apache.

the class HyperRowSetImpl method buildReader.

/**
   * Internal method to build the set of column readers needed for
   * this row set. Used when building a row set reader.
   * @param rowIndex object that points to the current row
   * @return an array of column readers: in the same order as the
   * (non-map) vectors.
   */
protected RowSetReader buildReader(HyperRowIndex rowIndex) {
    FlattenedSchema accessSchema = schema().flatAccess();
    AbstractColumnReader[] readers = new AbstractColumnReader[accessSchema.count()];
    for (int i = 0; i < readers.length; i++) {
        MaterializedField field = accessSchema.column(i);
        readers[i] = ColumnAccessorFactory.newReader(field.getType());
        HyperVectorWrapper<ValueVector> hvw = getHyperVector(i);
        readers[i].bind(rowIndex, field, new HyperVectorAccessor(hvw, rowIndex));
    }
    return new RowSetReaderImpl(accessSchema, rowIndex, readers);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) FlattenedSchema(org.apache.drill.test.rowSet.RowSetSchema.FlattenedSchema) MaterializedField(org.apache.drill.exec.record.MaterializedField) AbstractColumnReader(org.apache.drill.exec.vector.accessor.impl.AbstractColumnReader)

Aggregations

ValueVector (org.apache.drill.exec.vector.ValueVector)2 AbstractColumnReader (org.apache.drill.exec.vector.accessor.impl.AbstractColumnReader)2 FlattenedSchema (org.apache.drill.test.rowSet.RowSetSchema.FlattenedSchema)2 MinorType (org.apache.drill.common.types.TypeProtos.MinorType)1 MaterializedField (org.apache.drill.exec.record.MaterializedField)1