use of org.apache.carbondata.core.keygenerator.mdkey.Bits in project carbondata by apache.
the class PrimitiveQueryType method getDataBasedOnDataTypeFromSurrogates.
@Override
public Object getDataBasedOnDataTypeFromSurrogates(ByteBuffer surrogateData) {
byte[] data = new byte[keySize];
surrogateData.get(data);
Bits bit = new Bits(new int[] { keySize * 8 });
int surrgateValue = (int) bit.getKeyArray(data, 0)[0];
Object actualData = null;
if (isDirectDictionary) {
DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(dataType);
actualData = directDictionaryGenerator.getValueFromSurrogate(surrgateValue);
} else {
String dictionaryValueForKey = dictionary.getDictionaryValueForKey(surrgateValue);
actualData = DataTypeUtil.getDataBasedOnDataType(dictionaryValueForKey, this.dataType);
}
return actualData;
}
use of org.apache.carbondata.core.keygenerator.mdkey.Bits in project carbondata by apache.
the class PrimitiveQueryTypeTest method getDataBasedOnDataTypeFromSurrogates.
public Object getDataBasedOnDataTypeFromSurrogates(ByteBuffer surrogateData) {
int keySize = 2;
byte[] data = new byte[keySize];
surrogateData.get(data);
Bits bit = new Bits(new int[] { keySize * 8 });
int surrgateValue = (int) bit.getKeyArray(data, 0)[0];
Object actualData = null;
if (isDirectDictionary) {
DirectDictionaryGenerator directDictionaryGenerator = DirectDictionaryKeyGeneratorFactory.getDirectDictionaryGenerator(DataTypes.TIMESTAMP);
actualData = directDictionaryGenerator.getValueFromSurrogate(surrgateValue);
} else {
String dictionaryValueForKey = dictionary.getDictionaryValueForKey(surrgateValue);
actualData = DataTypeUtil.getDataBasedOnDataType(dictionaryValueForKey, DataTypes.TIMESTAMP);
}
return actualData;
}
Aggregations