Interface BitmapSliceIndex

  • All Known Implementing Classes:
    ImmutableBitSliceIndex, MutableBitSliceIndex, RoaringBitmapSliceIndex

    public interface BitmapSliceIndex
    BitSliceIndex bit slice index can be used to 1. store high cardinality dim column for OLAP system. 2. high compression ratio for number Given that,we have a table T(c1,c2,c3....Cn). As we know,most database has rowId for each row. then table T is actually T(rowId,c1,c2,c3,Cn). 1. if column c1 is string, we can encode c1 using dictionary. By bsi, we can only use 33 bit slice express 2^32 cardinality dim. 2. if column c2 is int32(that is 4Byte), for 1_000_000 rows, the size of c2 is more than 3.81MB. however, by bsi, the size might be less than 1MB.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int bitCount()  
      long getLongCardinality()  
      Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)  
      void serialize​(java.io.DataOutput output)  
      void serialize​(java.nio.ByteBuffer buffer)  
      int serializedSizeInBytes()  
      void setValue​(int columnId, int value)
      set value for bsi, setValue will set each bit slice according to the input value given that we have bsi as follow ebm: RB[1 1 1 1] slice0: RB[0 1 0 1] - slice1: RB[1 0 1 0] | slice2: RB[1 0 0 1] |--bA:bit slice Array slice3: RB[0 0 0 1] - 1 2 3 4 | ---------------- columnId or rowId for columnId 1, the value is 110 that is :6 for columnId 2, the value is 1 that is :1 for columnId 3, the value is 10 that is :2 for columnId 4, the value is 1101 that is :11
      void setValues​(java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> values, java.lang.Integer currentMaxValue, java.lang.Integer currentMinValue)
      setValues will batch set value for this bsi.
    • Method Detail

      • bitCount

        int bitCount()
      • getLongCardinality

        long getLongCardinality()
      • setValue

        void setValue​(int columnId,
                      int value)
        set value for bsi, setValue will set each bit slice according to the input value given that we have bsi as follow ebm: RB[1 1 1 1] slice0: RB[0 1 0 1] - slice1: RB[1 0 1 0] | slice2: RB[1 0 0 1] |--bA:bit slice Array slice3: RB[0 0 0 1] - 1 2 3 4 | ---------------- columnId or rowId for columnId 1, the value is 110 that is :6 for columnId 2, the value is 1 that is :1 for columnId 3, the value is 10 that is :2 for columnId 4, the value is 1101 that is :11
        Parameters:
        columnId - columnId or rowId
        value - value for this columnId or rowId
      • getValue

        Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)
        Parameters:
        columnId - columnId or rowId
        Returns:
        the value of this columnId
      • setValues

        void setValues​(java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> values,
                       java.lang.Integer currentMaxValue,
                       java.lang.Integer currentMinValue)
        setValues will batch set value for this bsi. currentMaxValue/currentMinValue are optional,it's can be compute from input value list. and avoiding bsi expend slice array capacity.
      • serialize

        void serialize​(java.nio.ByteBuffer buffer)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • serialize

        void serialize​(java.io.DataOutput output)
                throws java.io.IOException
        Throws:
        java.io.IOException
      • serializedSizeInBytes

        int serializedSizeInBytes()