use of org.apache.carbondata.format.Encoding in project carbondata by apache.
the class DirectDictDimensionIndexCodec method createEncoder.
@Override
public ColumnPageEncoder createEncoder(Map<String, String> parameter) {
return new IndexStorageEncoder() {
@Override
void encodeIndexStorage(ColumnPage inputPage) {
IndexStorage indexStorage;
byte[][] data = inputPage.getByteArrayPage();
if (isInvertedIndex) {
indexStorage = new BlockIndexerStorageForShort(data, false, false, isSort);
} else {
indexStorage = new BlockIndexerStorageForNoInvertedIndexForShort(data, false);
}
byte[] flattened = ByteUtil.flatten(indexStorage.getDataPage());
super.compressedDataPage = compressor.compressByte(flattened);
super.indexStorage = indexStorage;
}
@Override
protected List<Encoding> getEncodingList() {
List<Encoding> encodings = new ArrayList<>();
encodings.add(Encoding.DICTIONARY);
encodings.add(Encoding.RLE);
if (isInvertedIndex) {
encodings.add(Encoding.INVERTED_INDEX);
}
return encodings;
}
};
}
use of org.apache.carbondata.format.Encoding in project carbondata by apache.
the class HighCardDictDimensionIndexCodec method createEncoder.
@Override
public ColumnPageEncoder createEncoder(Map<String, String> parameter) {
return new IndexStorageEncoder() {
@Override
protected void encodeIndexStorage(ColumnPage input) {
IndexStorage indexStorage;
byte[][] data = input.getByteArrayPage();
if (isInvertedIndex) {
indexStorage = new BlockIndexerStorageForShort(data, false, true, isSort);
} else {
indexStorage = new BlockIndexerStorageForNoInvertedIndexForShort(data, true);
}
byte[] flattened = ByteUtil.flatten(indexStorage.getDataPage());
super.compressedDataPage = compressor.compressByte(flattened);
super.indexStorage = indexStorage;
}
@Override
protected List<Encoding> getEncodingList() {
List<Encoding> encodings = new ArrayList<>();
if (indexStorage.getRowIdPageLengthInBytes() > 0) {
encodings.add(Encoding.INVERTED_INDEX);
}
return encodings;
}
};
}
Aggregations