Search in sources :

Example 1 with BlockIndexerStorageForNoInvertedIndexForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort in project carbondata by apache.

the class DictDimensionIndexCodec 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, true, 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;
        }
    };
}
Also used : ColumnPage(org.apache.carbondata.core.datastore.page.ColumnPage) BlockIndexerStorageForNoInvertedIndexForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort) ArrayList(java.util.ArrayList) BlockIndexerStorageForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort) Encoding(org.apache.carbondata.format.Encoding) IndexStorage(org.apache.carbondata.core.datastore.columnar.IndexStorage)

Example 2 with BlockIndexerStorageForNoInvertedIndexForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort 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;
        }
    };
}
Also used : ColumnPage(org.apache.carbondata.core.datastore.page.ColumnPage) BlockIndexerStorageForNoInvertedIndexForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort) ArrayList(java.util.ArrayList) BlockIndexerStorageForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort) Encoding(org.apache.carbondata.format.Encoding) IndexStorage(org.apache.carbondata.core.datastore.columnar.IndexStorage)

Example 3 with BlockIndexerStorageForNoInvertedIndexForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort 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;
        }
    };
}
Also used : ColumnPage(org.apache.carbondata.core.datastore.page.ColumnPage) BlockIndexerStorageForNoInvertedIndexForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort) ArrayList(java.util.ArrayList) BlockIndexerStorageForShort(org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort) Encoding(org.apache.carbondata.format.Encoding) IndexStorage(org.apache.carbondata.core.datastore.columnar.IndexStorage)

Aggregations

ArrayList (java.util.ArrayList)3 BlockIndexerStorageForNoInvertedIndexForShort (org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort)3 BlockIndexerStorageForShort (org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort)3 IndexStorage (org.apache.carbondata.core.datastore.columnar.IndexStorage)3 ColumnPage (org.apache.carbondata.core.datastore.page.ColumnPage)3 Encoding (org.apache.carbondata.format.Encoding)3