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 vectorInfo
* @param column
* @param restructuringInfo
* @return next column index
*/
@Override
public int fillConvertedChunkData(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(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;
}
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 vectorInfo
* @param column
* @param restructuringInfo
* @return next column index
*/
@Override
public int fillConvertedChunkData(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(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;
}
use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.
the class AbstractScannedResult method fillColumnarImplicitBatch.
/**
* Fill the column data to vector
*/
public void fillColumnarImplicitBatch(ColumnVectorInfo[] vectorInfo) {
int column = 0;
for (int i = 0; i < vectorInfo.length; i++) {
ColumnVectorInfo columnVectorInfo = vectorInfo[column];
CarbonColumnVector vector = columnVectorInfo.vector;
int offset = columnVectorInfo.offset;
int vectorOffset = columnVectorInfo.vectorOffset;
int len = offset + columnVectorInfo.size;
for (int j = offset; j < len; j++) {
// Considering only String case now as we support only
String data = getBlockletId();
if (CarbonCommonConstants.CARBON_IMPLICIT_COLUMN_TUPLEID.equals(columnVectorInfo.dimension.getColumnName())) {
data = data + CarbonCommonConstants.FILE_SEPARATOR + (rowMapping == null ? j : rowMapping[pageCounter][j]);
}
vector.putBytes(vectorOffset++, offset, data.length(), data.getBytes());
}
}
}
use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.
the class DictionaryBasedVectorResultCollector method prepareDimensionAndMeasureColumnVectors.
protected void prepareDimensionAndMeasureColumnVectors() {
measureColumnInfo = new ColumnVectorInfo[queryMeasures.length];
List<ColumnVectorInfo> dictInfoList = new ArrayList<>();
List<ColumnVectorInfo> noDictInfoList = new ArrayList<>();
List<ColumnVectorInfo> complexList = new ArrayList<>();
List<ColumnVectorInfo> implictColumnList = new ArrayList<>();
for (int i = 0; i < queryDimensions.length; i++) {
if (queryDimensions[i].getDimension().hasEncoding(Encoding.IMPLICIT)) {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
implictColumnList.add(columnVectorInfo);
columnVectorInfo.dimension = queryDimensions[i];
columnVectorInfo.ordinal = queryDimensions[i].getDimension().getOrdinal();
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
} else if (!queryDimensions[i].getDimension().hasEncoding(Encoding.DICTIONARY)) {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
noDictInfoList.add(columnVectorInfo);
columnVectorInfo.dimension = queryDimensions[i];
columnVectorInfo.ordinal = queryDimensions[i].getDimension().getOrdinal();
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
} else if (queryDimensions[i].getDimension().hasEncoding(Encoding.DIRECT_DICTIONARY)) {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
dictInfoList.add(columnVectorInfo);
columnVectorInfo.dimension = queryDimensions[i];
columnVectorInfo.directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(queryDimensions[i].getDimension().getDataType());
columnVectorInfo.ordinal = queryDimensions[i].getDimension().getOrdinal();
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
} else if (queryDimensions[i].getDimension().isComplex()) {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
complexList.add(columnVectorInfo);
columnVectorInfo.dimension = queryDimensions[i];
columnVectorInfo.ordinal = queryDimensions[i].getDimension().getOrdinal();
columnVectorInfo.genericQueryType = tableBlockExecutionInfos.getComlexDimensionInfoMap().get(columnVectorInfo.ordinal);
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
} else {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
dictInfoList.add(columnVectorInfo);
columnVectorInfo.dimension = queryDimensions[i];
columnVectorInfo.ordinal = queryDimensions[i].getDimension().getOrdinal();
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
}
}
for (int i = 0; i < queryMeasures.length; i++) {
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
columnVectorInfo.measureVectorFiller = MeasureDataVectorProcessor.MeasureVectorFillerFactory.getMeasureVectorFiller(queryMeasures[i].getMeasure().getDataType());
columnVectorInfo.ordinal = queryMeasures[i].getMeasure().getOrdinal();
columnVectorInfo.measure = queryMeasures[i];
this.measureColumnInfo[i] = columnVectorInfo;
allColumnInfo[queryMeasures[i].getQueryOrder()] = columnVectorInfo;
}
dictionaryInfo = dictInfoList.toArray(new ColumnVectorInfo[dictInfoList.size()]);
noDictionaryInfo = noDictInfoList.toArray(new ColumnVectorInfo[noDictInfoList.size()]);
complexInfo = complexList.toArray(new ColumnVectorInfo[complexList.size()]);
implictColumnInfo = implictColumnList.toArray(new ColumnVectorInfo[implictColumnList.size()]);
Arrays.sort(dictionaryInfo);
Arrays.sort(complexInfo);
}
use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.
the class RestructureBasedVectorResultCollector method createVectorForNewlyAddedDimensions.
/**
* create column vector for newly added dimension columns
*/
private void createVectorForNewlyAddedDimensions() {
for (int i = 0; i < queryDimensions.length; i++) {
if (!dimensionInfo.getDimensionExists()[i]) {
// add a dummy column vector result collector object
ColumnVectorInfo columnVectorInfo = new ColumnVectorInfo();
allColumnInfo[queryDimensions[i].getQueryOrder()] = columnVectorInfo;
}
}
}
Aggregations