Search in sources :

Example 1 with ConvertibleVector

use of org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector in project carbondata by apache.

the class SafeFixedLengthDimensionDataChunkStore method fillVector.

@Override
public void fillVector(int[] invertedIndex, int[] invertedIndexReverse, byte[] data, ColumnVectorInfo vectorInfo) {
    CarbonColumnVector vector = vectorInfo.vector;
    BitSet deletedRows = vectorInfo.deletedRows;
    BitSet nullBits = new BitSet(numOfRows);
    vector = ColumnarVectorWrapperDirectFactory.getDirectVectorWrapperFactory(vectorInfo, vector, invertedIndex, nullBits, deletedRows, false, false);
    fillVector(data, vectorInfo, vector);
    if (vector instanceof ConvertibleVector) {
        ((ConvertibleVector) vector).convert();
    }
}
Also used : ConvertibleVector(org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector) BitSet(java.util.BitSet) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Example 2 with ConvertibleVector

use of org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector in project carbondata by apache.

the class LocalDictDimensionDataChunkStore method fillVector.

@Override
public void fillVector(int[] invertedIndex, int[] invertedIndexReverse, byte[] data, ColumnVectorInfo vectorInfo) {
    int columnValueSize = dimensionDataChunkStore.getColumnValueSize();
    int rowsNum = dataLength / columnValueSize;
    CarbonColumnVector vector = vectorInfo.vector;
    if (vector.getType().isComplexType()) {
        if (DataTypes.isStructType(vector.getType())) {
            int deletedRow = vectorInfo.deletedRows != null ? vectorInfo.deletedRows.cardinality() : 0;
            rowsNum = dataLength - deletedRow;
        } else {
            // this is not required to be changed in the case of the array because
            // datalength of the array already taking care of deleted rows in
            // ColumnVectorInfo.getUpdatedPageSizeForChildVector
            rowsNum = dataLength;
        }
        vector = vectorInfo.vectorStack.peek();
        CarbonColumnVector sliceVector = vector.getColumnVector();
        // use rowsNum as positionCount in order to create dictionary block
        sliceVector.setPositionCount(rowsNum);
        sliceVector.setIsLocalDictEnabledForComplextype(true);
    }
    if (!dictionary.isDictionaryUsed()) {
        vector.setDictionary(dictionary);
        dictionary.setDictionaryUsed();
    }
    BitSet nullBitset = new BitSet();
    CarbonColumnVector dictionaryVector = ColumnarVectorWrapperDirectFactory.getDirectVectorWrapperFactory(vectorInfo, vector.getDictionaryVector(), invertedIndex, nullBitset, vectorInfo.deletedRows, false, true);
    vector = ColumnarVectorWrapperDirectFactory.getDirectVectorWrapperFactory(vectorInfo, vector, invertedIndex, nullBitset, vectorInfo.deletedRows, false, false);
    // this check is in case of array of string type
    if (vectorInfo.vector.getType().isComplexType() && dictionaryVector instanceof CarbonColumnVectorImpl && ((CarbonColumnVectorImpl) dictionaryVector).getIntArraySize() < rowsNum) {
        ((CarbonColumnVectorImpl) dictionaryVector).increaseIntArraySize(rowsNum);
    }
    for (int i = 0; i < rowsNum; i++) {
        int surrogate = CarbonUtil.getSurrogateInternal(data, i * columnValueSize, columnValueSize);
        // MEMBER_DEFAULT_VAL_SURROGATE_KEY. Therefore check should be using MEMBER_DEFAULT_VAL_ARRAY
        if (surrogate == CarbonCommonConstants.MEMBER_DEFAULT_VAL_SURROGATE_KEY || Arrays.equals(CarbonCommonConstants.MEMBER_DEFAULT_VAL_ARRAY, dictionary.getDictionaryValue(surrogate))) {
            vector.putNull(i);
            dictionaryVector.putNull(i);
        } else {
            // if vector is 'ColumnarVectorWrapperDirectWithDeleteDelta', it needs to call 'putNotNull'
            // to increase 'counter', otherwise it will set the null value to the wrong index.
            vector.putNotNull(i);
            dictionaryVector.putInt(i, surrogate);
        }
    }
    if (dictionaryVector instanceof ConvertibleVector) {
        ((ConvertibleVector) dictionaryVector).convert();
    }
}
Also used : ConvertibleVector(org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector) BitSet(java.util.BitSet) CarbonColumnVectorImpl(org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Example 3 with ConvertibleVector

use of org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector in project carbondata by apache.

the class SafeVariableLengthDimensionDataChunkStore method fillVector.

@Override
public void fillVector(int[] invertedIndex, int[] invertedIndexReverse, byte[] data, ColumnVectorInfo vectorInfo) {
    CarbonColumnVector vector = vectorInfo.vector;
    vector.setDictionary(null);
    DataType dt = vector.getType();
    AbstractNonDictionaryVectorFiller vectorFiller = NonDictionaryVectorFillerFactory.getVectorFiller(getLengthSize(), dt, numberOfRows, dataLength);
    vector = ColumnarVectorWrapperDirectFactory.getDirectVectorWrapperFactory(vectorInfo, vector, invertedIndex, new BitSet(), vectorInfo.deletedRows, false, false);
    vectorFiller.fillVector(data, vector);
    if (vector instanceof ConvertibleVector) {
        ((ConvertibleVector) vector).convert();
    }
}
Also used : ConvertibleVector(org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector) BitSet(java.util.BitSet) DataType(org.apache.carbondata.core.metadata.datatype.DataType) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Aggregations

BitSet (java.util.BitSet)3 CarbonColumnVector (org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)3 ConvertibleVector (org.apache.carbondata.core.scan.result.vector.impl.directread.ConvertibleVector)3 DataType (org.apache.carbondata.core.metadata.datatype.DataType)1 CarbonColumnVectorImpl (org.apache.carbondata.core.scan.result.vector.impl.CarbonColumnVectorImpl)1