Search in sources :

Example 1 with ColumnVectorInfo

use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.

the class RestructureBasedVectorResultCollector method createVectorForNewlyAddedMeasures.

/**
   * create column vector for newly added measure columns
   */
private void createVectorForNewlyAddedMeasures() {
    for (int i = 0; i < queryMeasures.length; i++) {
        if (!measureInfo.getMeasureExists()[i]) {
            // add a dummy column vector result collector object
            ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
            allColumnInfo[queryMeasures[i].getQueryOrder()] = columnVectorInfo;
            measureDefaultValues[i] = getMeasureDefaultValue(queryMeasures[i].getMeasure());
        }
    }
}
Also used : ColumnVectorInfo(org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo)

Example 2 with ColumnVectorInfo

use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.

the class FixedLengthDimensionDataChunk method fillConvertedChunkData.

/**
   * Fill the data to vector
   *
   * @param rowMapping
   * @param vectorInfo
   * @param column
   * @param restructuringInfo
   * @return next column index
   */
@Override
public int fillConvertedChunkData(int[] rowMapping, ColumnVectorInfo[] vectorInfo, int column, KeyStructureInfo restructuringInfo) {
    ColumnVectorInfo columnVectorInfo = vectorInfo[column];
    int offset = columnVectorInfo.offset;
    int vectorOffset = columnVectorInfo.vectorOffset;
    int len = columnVectorInfo.size + offset;
    CarbonColumnVector vector = columnVectorInfo.vector;
    for (int j = offset; j < len; j++) {
        int dict = dataChunkStore.getSurrogate(rowMapping[j]);
        if (columnVectorInfo.directDictionaryGenerator == null) {
            vector.putInt(vectorOffset++, dict);
        } else {
            Object valueFromSurrogate = columnVectorInfo.directDictionaryGenerator.getValueFromSurrogate(dict);
            if (valueFromSurrogate == null) {
                vector.putNull(vectorOffset++);
            } else {
                switch(columnVectorInfo.directDictionaryGenerator.getReturnType()) {
                    case INT:
                        vector.putInt(vectorOffset++, (int) valueFromSurrogate);
                        break;
                    case LONG:
                        vector.putLong(vectorOffset++, (long) valueFromSurrogate);
                        break;
                }
            }
        }
    }
    return column + 1;
}
Also used : ColumnVectorInfo(org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Example 3 with ColumnVectorInfo

use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.

the class VariableLengthDimensionDataChunk method fillConvertedChunkData.

/**
   * Fill the data to vector
   *
   * @param rowMapping
   * @param vectorInfo
   * @param column
   * @param restructuringInfo
   * @return next column index
   */
@Override
public int fillConvertedChunkData(int[] rowMapping, ColumnVectorInfo[] vectorInfo, int column, KeyStructureInfo restructuringInfo) {
    ColumnVectorInfo columnVectorInfo = vectorInfo[column];
    CarbonColumnVector vector = columnVectorInfo.vector;
    int offset = columnVectorInfo.offset;
    int vectorOffset = columnVectorInfo.vectorOffset;
    int len = offset + columnVectorInfo.size;
    for (int i = offset; i < len; i++) {
        // Considering only String case now as we support only
        // string in no dictionary case at present.
        dataChunkStore.fillRow(rowMapping[i], vector, vectorOffset++);
    }
    return column + 1;
}
Also used : ColumnVectorInfo(org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Example 4 with ColumnVectorInfo

use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.

the class VariableLengthDimensionDataChunk method fillConvertedChunkData.

/**
   * Fill the data to vector
   *
   * @param vectorInfo
   * @param column
   * @param restructuringInfo
   * @return next column index
   */
@Override
public int fillConvertedChunkData(ColumnVectorInfo[] vectorInfo, int column, KeyStructureInfo restructuringInfo) {
    ColumnVectorInfo columnVectorInfo = vectorInfo[column];
    CarbonColumnVector vector = columnVectorInfo.vector;
    int offset = columnVectorInfo.offset;
    int vectorOffset = columnVectorInfo.vectorOffset;
    int len = offset + columnVectorInfo.size;
    for (int i = offset; i < len; i++) {
        // Considering only String case now as we support only
        // string in no dictionary case at present.
        dataChunkStore.fillRow(i, vector, vectorOffset++);
    }
    return column + 1;
}
Also used : ColumnVectorInfo(org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo) CarbonColumnVector(org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)

Example 5 with ColumnVectorInfo

use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.

the class ColumnGroupDimensionDataChunk method fillConvertedChunkData.

/**
   * Fill the data to vector
   *
   * @param rowMapping
   * @param vectorInfo
   * @param column
   * @param restructuringInfo
   * @return next column index
   */
@Override
public int fillConvertedChunkData(int[] rowMapping, ColumnVectorInfo[] vectorInfo, int column, KeyStructureInfo restructuringInfo) {
    ColumnVectorInfo columnVectorInfo = vectorInfo[column];
    int offset = columnVectorInfo.offset;
    int vectorOffset = columnVectorInfo.vectorOffset;
    int len = offset + columnVectorInfo.size;
    int[] ordinal = restructuringInfo.getMdkeyQueryDimensionOrdinal();
    for (int k = offset; k < len; k++) {
        long[] keyArray = restructuringInfo.getKeyGenerator().getKeyArray(dataChunkStore.getRow(rowMapping[k]));
        int index = 0;
        for (int i = column; i < column + ordinal.length; i++) {
            if (vectorInfo[i].directDictionaryGenerator == null) {
                vectorInfo[i].vector.putInt(vectorOffset, (int) keyArray[ordinal[index++]]);
            } else {
                vectorInfo[i].vector.putLong(vectorOffset, (long) vectorInfo[i].directDictionaryGenerator.getValueFromSurrogate((int) keyArray[ordinal[index++]]));
            }
        }
        vectorOffset++;
    }
    return column + ordinal.length;
}
Also used : ColumnVectorInfo(org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo)

Aggregations

ColumnVectorInfo (org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo)11 CarbonColumnVector (org.apache.carbondata.core.scan.result.vector.CarbonColumnVector)6 ArrayList (java.util.ArrayList)1 CarbonMeasure (org.apache.carbondata.core.metadata.schema.table.column.CarbonMeasure)1