Search in sources :

Example 1 with BaseRepeatedValueVector

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

the class BatchValidator method validateRepeatedVector.

private void validateRepeatedVector(String name, BaseRepeatedValueVector vector) {
    int dataLength = Integer.MAX_VALUE;
    if (vector instanceof RepeatedVarCharVector) {
        dataLength = ((RepeatedVarCharVector) vector).getOffsetVector().getValueCapacity();
    } else if (vector instanceof RepeatedFixedWidthVectorLike) {
        dataLength = ((BaseDataValueVector) ((BaseRepeatedValueVector) vector).getDataVector()).getBuffer().capacity();
    }
    int itemCount = validateOffsetVector(name + "-offsets", vector.getOffsetVector(), rowCount, dataLength);
    // Special handling of repeated VarChar vectors
    // The nested data vectors are not quite exactly like top-level vectors.
    @SuppressWarnings("resource") ValueVector dataVector = vector.getDataVector();
    if (dataVector instanceof VariableWidthVector) {
        validateVariableWidthVector(name + "-data", (VariableWidthVector) dataVector, itemCount);
    }
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) BaseRepeatedValueVector(org.apache.drill.exec.vector.complex.BaseRepeatedValueVector) BaseDataValueVector(org.apache.drill.exec.vector.BaseDataValueVector) RepeatedVarCharVector(org.apache.drill.exec.vector.RepeatedVarCharVector) RepeatedFixedWidthVectorLike(org.apache.drill.exec.vector.complex.RepeatedFixedWidthVectorLike) BaseRepeatedValueVector(org.apache.drill.exec.vector.complex.BaseRepeatedValueVector) VariableWidthVector(org.apache.drill.exec.vector.VariableWidthVector)

Example 2 with BaseRepeatedValueVector

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

the class BatchValidator method validateRepeatedVector.

private void validateRepeatedVector(String name, BaseRepeatedValueVector vector) {
    ValueVector dataVector = vector.getDataVector();
    int dataLength = dataVector.getAccessor().getValueCount();
    int valueCount = vector.getAccessor().getValueCount();
    int itemCount = validateOffsetVector(name + "-offsets", vector.getOffsetVector(), valueCount, dataLength);
    if (dataLength != itemCount) {
        error(name, vector, String.format("Data vector has %d values, but offset vector has %d values", dataLength, itemCount));
    }
    // Special handling of repeated VarChar vectors
    // The nested data vectors are not quite exactly like top-level vectors.
    validateVector(name + "-data", dataVector);
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) BaseRepeatedValueVector(org.apache.drill.exec.vector.complex.BaseRepeatedValueVector)

Aggregations

ValueVector (org.apache.drill.exec.vector.ValueVector)2 BaseRepeatedValueVector (org.apache.drill.exec.vector.complex.BaseRepeatedValueVector)2 BaseDataValueVector (org.apache.drill.exec.vector.BaseDataValueVector)1 RepeatedVarCharVector (org.apache.drill.exec.vector.RepeatedVarCharVector)1 VariableWidthVector (org.apache.drill.exec.vector.VariableWidthVector)1 RepeatedFixedWidthVectorLike (org.apache.drill.exec.vector.complex.RepeatedFixedWidthVectorLike)1