Search in sources :

Example 26 with RepeatedValueVector

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

the class UnnestRecordBatch method setUnnestVector.

private void setUnnestVector() {
    MaterializedField field = incoming.getSchema().getColumn(unnestTypedFieldId.getFieldIds()[0]);
    RepeatedValueVector vector;
    ValueVector inVV = incoming.getValueAccessorById(field.getValueClass(), unnestTypedFieldId.getFieldIds()).getValueVector();
    if (!(inVV instanceof RepeatedValueVector)) {
        if (incoming.getRecordCount() != 0) {
            throw UserException.unsupportedError().message("Unnest does not support inputs of non-list values.").build(logger);
        }
        // Inherited from FLATTEN. When does this happen???
        // when incoming recordCount is 0, don't throw exception since the type being seen here is not solid
        logger.error("setUnnestVector cast failed and recordcount is 0, create empty vector anyway.");
        vector = new RepeatedMapVector(field, oContext.getAllocator(), null);
    } else {
        vector = RepeatedValueVector.class.cast(inVV);
    }
    unnest.setUnnestField(vector);
}
Also used : RepeatedValueVector(org.apache.drill.exec.vector.complex.RepeatedValueVector) ValueVector(org.apache.drill.exec.vector.ValueVector) RepeatedValueVector(org.apache.drill.exec.vector.complex.RepeatedValueVector) RepeatedMapVector(org.apache.drill.exec.vector.complex.RepeatedMapVector) MaterializedField(org.apache.drill.exec.record.MaterializedField)

Aggregations

RepeatedValueVector (org.apache.drill.exec.vector.complex.RepeatedValueVector)26 ValueVector (org.apache.drill.exec.vector.ValueVector)22 UInt4Vector (org.apache.drill.exec.vector.UInt4Vector)14 Test (org.junit.Test)13 ColumnSize (org.apache.drill.exec.record.RecordBatchSizer.ColumnSize)9 RepeatedMapVector (org.apache.drill.exec.vector.complex.RepeatedMapVector)9 SubOperatorTest (org.apache.drill.test.SubOperatorTest)9 SingleRowSet (org.apache.drill.exec.physical.rowSet.RowSet.SingleRowSet)7 SchemaBuilder (org.apache.drill.exec.record.metadata.SchemaBuilder)7 TupleMetadata (org.apache.drill.exec.record.metadata.TupleMetadata)7 RowSet (org.apache.drill.exec.physical.rowSet.RowSet)6 RowSetBuilder (org.apache.drill.exec.physical.rowSet.RowSetBuilder)6 ScanBatch (org.apache.drill.exec.physical.impl.ScanBatch)4 RecordBatch (org.apache.drill.exec.record.RecordBatch)4 RecordBatchSizer (org.apache.drill.exec.record.RecordBatchSizer)4 TypedFieldId (org.apache.drill.exec.record.TypedFieldId)4 VectorAccessible (org.apache.drill.exec.record.VectorAccessible)4 RepeatedListVector (org.apache.drill.exec.vector.complex.RepeatedListVector)4 MaterializedField (org.apache.drill.exec.record.MaterializedField)3 TransferPair (org.apache.drill.exec.record.TransferPair)3