Search in sources :

Example 1 with BlockIndexerStorageForShort

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

the class ComplexDimensionIndexCodec method createEncoder.

@Override
public ColumnPageEncoder createEncoder(Map<String, String> parameter) {
    return new IndexStorageEncoder() {

        @Override
        void encodeIndexStorage(ColumnPage inputPage) {
            IndexStorage indexStorage = new BlockIndexerStorageForShort(inputPage.getByteArrayPage(), false, false, false);
            byte[] flattened = ByteUtil.flatten(indexStorage.getDataPage());
            byte[] compressed = compressor.compressByte(flattened);
            super.indexStorage = indexStorage;
            super.compressedDataPage = compressed;
        }

        @Override
        protected List<Encoding> getEncodingList() {
            List<Encoding> encodings = new ArrayList<>();
            encodings.add(Encoding.DICTIONARY);
            encodings.add(Encoding.INVERTED_INDEX);
            return encodings;
        }
    };
}
Also used : ColumnPage(org.apache.carbondata.core.datastore.page.ColumnPage) 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 BlockIndexerStorageForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort 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 3 with BlockIndexerStorageForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort 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 4 with BlockIndexerStorageForShort

use of org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort 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)4 BlockIndexerStorageForShort (org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForShort)4 IndexStorage (org.apache.carbondata.core.datastore.columnar.IndexStorage)4 ColumnPage (org.apache.carbondata.core.datastore.page.ColumnPage)4 Encoding (org.apache.carbondata.format.Encoding)4 BlockIndexerStorageForNoInvertedIndexForShort (org.apache.carbondata.core.datastore.columnar.BlockIndexerStorageForNoInvertedIndexForShort)3