Search in sources :

Example 1 with TupleObjectWriter

use of org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter.TupleObjectWriter in project drill by axbaretto.

the class ColumnWriterFactory method buildMapArray.

public static ArrayObjectWriter buildMapArray(ColumnMetadata schema, UInt4Vector offsetVector, List<AbstractObjectWriter> writers) {
    MapWriter mapWriter;
    if (schema.isProjected()) {
        mapWriter = new ArrayMapWriter(schema, writers);
    } else {
        mapWriter = new DummyArrayMapWriter(schema, writers);
    }
    TupleObjectWriter mapArray = new TupleObjectWriter(schema, mapWriter);
    AbstractArrayWriter arrayWriter;
    if (schema.isProjected()) {
        arrayWriter = new ObjectArrayWriter(offsetVector, mapArray);
    } else {
        arrayWriter = new DummyArrayWriter(mapArray);
    }
    return new ArrayObjectWriter(schema, arrayWriter);
}
Also used : ArrayMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.ArrayMapWriter) DummyArrayMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyArrayMapWriter) SingleMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.SingleMapWriter) DummyMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyMapWriter) DummyArrayWriter(org.apache.drill.exec.vector.accessor.writer.dummy.DummyArrayWriter) ArrayObjectWriter(org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.ArrayObjectWriter) ArrayMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.ArrayMapWriter) DummyArrayMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyArrayMapWriter) DummyArrayMapWriter(org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyArrayMapWriter) TupleObjectWriter(org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter.TupleObjectWriter)

Example 2 with TupleObjectWriter

use of org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter.TupleObjectWriter in project drill by apache.

the class ColumnBuilder method buildSingleMap.

private ColumnState buildSingleMap(ContainerState parent, ColumnMetadata columnSchema) {
    final ProjectionFilter projFilter = parent.projection();
    final ProjResult projResult = projFilter.projection(columnSchema);
    final MapVector vector;
    final VectorState vectorState;
    if (projResult.isProjected) {
        // vectors can be cached.
        assert columnSchema.tupleSchema().isEmpty();
        vector = new MapVector(columnSchema.schema(), parent.loader().allocator(), null);
        vectorState = new MapVectorState(vector, new NullVectorState());
    } else {
        vector = null;
        vectorState = new NullVectorState();
    }
    final TupleObjectWriter mapWriter = MapWriter.buildMap(columnSchema, vector, new ArrayList<>());
    final SingleMapState mapState = new SingleMapState(parent.loader(), parent.vectorCache().childCache(columnSchema.name()), projResult.mapFilter);
    return new MapColumnState(mapState, mapWriter, vectorState, parent.isVersioned());
}
Also used : SingleMapState(org.apache.drill.exec.physical.resultSet.impl.TupleState.SingleMapState) MapVectorState(org.apache.drill.exec.physical.resultSet.impl.TupleState.MapVectorState) ProjResult(org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult) MapColumnState(org.apache.drill.exec.physical.resultSet.impl.TupleState.MapColumnState) MapVectorState(org.apache.drill.exec.physical.resultSet.impl.TupleState.MapVectorState) RepeatedListVectorState(org.apache.drill.exec.physical.resultSet.impl.RepeatedListState.RepeatedListVectorState) UnionVectorState(org.apache.drill.exec.physical.resultSet.impl.UnionState.UnionVectorState) OffsetVectorState(org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.OffsetVectorState) ListVectorState(org.apache.drill.exec.physical.resultSet.impl.ListState.ListVectorState) SimpleVectorState(org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.SimpleVectorState) TupleObjectWriter(org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter.TupleObjectWriter) RepeatedMapVector(org.apache.drill.exec.vector.complex.RepeatedMapVector) MapVector(org.apache.drill.exec.vector.complex.MapVector)

Aggregations

TupleObjectWriter (org.apache.drill.exec.vector.accessor.writer.AbstractTupleWriter.TupleObjectWriter)2 ListVectorState (org.apache.drill.exec.physical.resultSet.impl.ListState.ListVectorState)1 ProjResult (org.apache.drill.exec.physical.resultSet.impl.ProjectionFilter.ProjResult)1 RepeatedListVectorState (org.apache.drill.exec.physical.resultSet.impl.RepeatedListState.RepeatedListVectorState)1 OffsetVectorState (org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.OffsetVectorState)1 SimpleVectorState (org.apache.drill.exec.physical.resultSet.impl.SingleVectorState.SimpleVectorState)1 MapColumnState (org.apache.drill.exec.physical.resultSet.impl.TupleState.MapColumnState)1 MapVectorState (org.apache.drill.exec.physical.resultSet.impl.TupleState.MapVectorState)1 SingleMapState (org.apache.drill.exec.physical.resultSet.impl.TupleState.SingleMapState)1 UnionVectorState (org.apache.drill.exec.physical.resultSet.impl.UnionState.UnionVectorState)1 ArrayObjectWriter (org.apache.drill.exec.vector.accessor.writer.AbstractArrayWriter.ArrayObjectWriter)1 ArrayMapWriter (org.apache.drill.exec.vector.accessor.writer.MapWriter.ArrayMapWriter)1 DummyArrayMapWriter (org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyArrayMapWriter)1 DummyMapWriter (org.apache.drill.exec.vector.accessor.writer.MapWriter.DummyMapWriter)1 SingleMapWriter (org.apache.drill.exec.vector.accessor.writer.MapWriter.SingleMapWriter)1 DummyArrayWriter (org.apache.drill.exec.vector.accessor.writer.dummy.DummyArrayWriter)1 MapVector (org.apache.drill.exec.vector.complex.MapVector)1 RepeatedMapVector (org.apache.drill.exec.vector.complex.RepeatedMapVector)1