use of org.apache.carbondata.core.scan.result.vector.ColumnVectorInfo in project carbondata by apache.
the class RestructureBasedVectorResultCollector method fillDataForNonExistingMeasures.
/**
* This method will fill the default values of non existing measures in the current block
*/
private void fillDataForNonExistingMeasures() {
for (int i = 0; i < tableBlockExecutionInfos.getActualQueryMeasures().length; i++) {
if (!measureInfo.getMeasureExists()[i]) {
int queryOrder = tableBlockExecutionInfos.getActualQueryMeasures()[i].getQueryOrder();
CarbonMeasure measure = tableBlockExecutionInfos.getActualQueryMeasures()[i].getMeasure();
ColumnVectorInfo columnVectorInfo = allColumnInfo[queryOrder];
CarbonColumnVector vector = columnVectorInfo.vector;
Object defaultValue = measureDefaultValues[i];
if (null == defaultValue) {
vector.putNulls(columnVectorInfo.vectorOffset, columnVectorInfo.size);
} else {
switch(measureInfo.getMeasureDataTypes()[i]) {
case SHORT:
vector.putShorts(columnVectorInfo.vectorOffset, columnVectorInfo.size, (short) defaultValue);
break;
case INT:
vector.putInts(columnVectorInfo.vectorOffset, columnVectorInfo.size, (int) defaultValue);
break;
case LONG:
vector.putLongs(columnVectorInfo.vectorOffset, columnVectorInfo.size, (long) defaultValue);
break;
case DECIMAL:
vector.putDecimals(columnVectorInfo.vectorOffset, columnVectorInfo.size, (Decimal) defaultValue, measure.getPrecision());
break;
default:
vector.putDoubles(columnVectorInfo.vectorOffset, columnVectorInfo.size, (double) defaultValue);
}
}
}
}
}
Aggregations