use of org.apache.carbondata.core.scan.wrappers.ByteArrayWrapper in project carbondata by apache.
the class RawBasedResultCollector method prepareRow.
protected void prepareRow(AbstractScannedResult scannedResult, List<Object[]> listBasedResult, QueryMeasure[] queryMeasures) {
Object[] row = new Object[1 + queryMeasures.length];
wrapper = new ByteArrayWrapper();
wrapper.setDictionaryKey(dictionaryKeyArray);
wrapper.setNoDictionaryKeys(noDictionaryKeyArray);
wrapper.setComplexTypesKeys(complexTypeKeyArray);
wrapper.setImplicitColumnByteArray(implicitColumnByteArray);
row[0] = wrapper;
fillMeasureData(row, 1, scannedResult);
listBasedResult.add(row);
}
use of org.apache.carbondata.core.scan.wrappers.ByteArrayWrapper in project carbondata by apache.
the class CompactionResultSortProcessor method prepareRowObjectForSorting.
/**
* This method will prepare the data from raw object that will take part in sorting
*
* @param row
* @return
*/
private Object[] prepareRowObjectForSorting(Object[] row) {
ByteArrayWrapper wrapper = (ByteArrayWrapper) row[0];
// ByteBuffer[] noDictionaryBuffer = new ByteBuffer[noDictionaryCount];
List<CarbonDimension> dimensions = segmentProperties.getDimensions();
Object[] preparedRow = new Object[dimensions.size() + measureCount];
// convert the dictionary from MDKey to surrogate key
byte[] dictionaryKey = wrapper.getDictionaryKey();
long[] keyArray = segmentProperties.getDimensionKeyGenerator().getKeyArray(dictionaryKey);
Object[] dictionaryValues = new Object[dimensionColumnCount + measureCount];
for (int i = 0; i < keyArray.length; i++) {
dictionaryValues[i] = Long.valueOf(keyArray[i]).intValue();
}
int noDictionaryIndex = 0;
int dictionaryIndex = 0;
for (int i = 0; i < dimensions.size(); i++) {
CarbonDimension dims = dimensions.get(i);
if (dims.hasEncoding(Encoding.DICTIONARY)) {
// dictionary
preparedRow[i] = dictionaryValues[dictionaryIndex++];
} else {
// no dictionary dims
preparedRow[i] = wrapper.getNoDictionaryKeyByIndex(noDictionaryIndex++);
}
}
// fill all the measures
// measures will always start from 1st index in the row object array
int measureIndexInRow = 1;
for (int i = 0; i < measureCount; i++) {
preparedRow[dimensionColumnCount + i] = getConvertedMeasureValue(row[measureIndexInRow++], dataTypes[i]);
}
return preparedRow;
}
Aggregations