Class BitSliceIndexBase

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.roaringbitmap.buffer.ImmutableRoaringBitmap[] bA
      the bit component slice Array of this bsi
      protected org.roaringbitmap.buffer.ImmutableRoaringBitmap ebM
      the exist bitmap of this bsi which means the columnId have value in this bsi
      protected int maxValue
      the maxValue of this bsi
      protected int minValue
      the minValue of this bsi
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected <T> java.util.concurrent.CompletableFuture<java.util.List<T>> allOf​(java.util.List<java.util.concurrent.CompletableFuture<T>> futuresList)  
      protected org.roaringbitmap.buffer.ImmutableRoaringBitmap batchIn​(int[] batch, java.util.Set<java.lang.Integer> values)  
      int bitCount()  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap compare​(BitmapSliceIndex.Operation operation, int startOrValue, int end, org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)
      BSI Compare use single thread this Function compose algorithm from O'Neil and Owen Kaser the GE algorithm is from Owen since the performance is better.
      long getLongCardinality()  
      Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)
      GetValue gets the value at the column ID.
      protected <T> java.util.concurrent.CompletableFuture<T> invokeAsync​(java.util.function.Supplier<T> supplier, java.util.function.Function<java.lang.Exception,​T> exceptionHandler, java.util.concurrent.Executor forkJoinExecutor)  
      protected <R> java.util.List<java.util.concurrent.CompletableFuture<R>> parallelExec​(java.util.function.Function<int[],​R> func, int parallelism, org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, java.util.concurrent.ExecutorService pool)
      use java threadPool to parallel exec
      org.roaringbitmap.buffer.ImmutableRoaringBitmap parallelIn​(int parallelism, org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, java.util.Set<java.lang.Integer> values, java.util.concurrent.ExecutorService pool)
      parallelIn search the given Set values, we scan the bsi,if the value in values, we add it to result Bitmap
      protected org.roaringbitmap.buffer.ImmutableRoaringBitmap parallelMR​(int parallelism, org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, java.util.function.Function<int[],​org.roaringbitmap.buffer.ImmutableRoaringBitmap> func, java.util.concurrent.ExecutorService pool)  
      MutableBitSliceIndex parallelTransposeWithCount​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int parallelism, java.util.concurrent.ExecutorService pool)
      TransposeWithCounts is a matrix transpose function that returns a BSI that has a columnID system defined by the values contained within the input BSI.
      org.roaringbitmap.buffer.ImmutableRoaringBitmap range​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int start, int end)  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeEQ​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)
      EQ: =
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeGE​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeGT​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeLE​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeLT​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)  
      org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeNEQ​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int predicate)
      NEQ: !=
      Pair<java.lang.Long,​java.lang.Long> sum​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)  
      java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> toPairList()  
      java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> toPairList​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)  
      org.roaringbitmap.buffer.MutableRoaringBitmap topK​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet, int k)  
      protected MutableBitSliceIndex transposeWithCount​(int[] batch)  
      boolean valueExist​(java.lang.Long columnId)
      valueExists tests whether the value exists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • maxValue

        protected int maxValue
        the maxValue of this bsi
      • minValue

        protected int minValue
        the minValue of this bsi
      • bA

        protected org.roaringbitmap.buffer.ImmutableRoaringBitmap[] bA
        the bit component slice Array of this bsi
      • ebM

        protected org.roaringbitmap.buffer.ImmutableRoaringBitmap ebM
        the exist bitmap of this bsi which means the columnId have value in this bsi
    • Constructor Detail

      • BitSliceIndexBase

        public BitSliceIndexBase()
    • Method Detail

      • bitCount

        public int bitCount()
      • getLongCardinality

        public long getLongCardinality()
      • getValue

        public Pair<java.lang.Integer,​java.lang.Boolean> getValue​(int columnId)
        GetValue gets the value at the column ID. Second param will be false for non-existence values.
      • valueExist

        public boolean valueExist​(java.lang.Long columnId)
        valueExists tests whether the value exists.
      • parallelExec

        protected <R> java.util.List<java.util.concurrent.CompletableFuture<R>> parallelExec​(java.util.function.Function<int[],​R> func,
                                                                                             int parallelism,
                                                                                             org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                                             java.util.concurrent.ExecutorService pool)
        use java threadPool to parallel exec
        Parameters:
        func - to exec
        parallelism -
        foundSet -
        pool - threadPool to exec
        Returns:
      • allOf

        protected <T> java.util.concurrent.CompletableFuture<java.util.List<T>> allOf​(java.util.List<java.util.concurrent.CompletableFuture<T>> futuresList)
      • parallelMR

        protected org.roaringbitmap.buffer.ImmutableRoaringBitmap parallelMR​(int parallelism,
                                                                             org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                             java.util.function.Function<int[],​org.roaringbitmap.buffer.ImmutableRoaringBitmap> func,
                                                                             java.util.concurrent.ExecutorService pool)
                                                                      throws java.lang.InterruptedException,
                                                                             java.util.concurrent.ExecutionException
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
      • invokeAsync

        protected <T> java.util.concurrent.CompletableFuture<T> invokeAsync​(java.util.function.Supplier<T> supplier,
                                                                            java.util.function.Function<java.lang.Exception,​T> exceptionHandler,
                                                                            java.util.concurrent.Executor forkJoinExecutor)
      • topK

        public org.roaringbitmap.buffer.MutableRoaringBitmap topK​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                  int k)
      • rangeEQ

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeEQ​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                       int predicate)
        EQ: =
        Parameters:
        foundSet -
        predicate -
        Returns:
      • rangeNEQ

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeNEQ​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                        int predicate)
        NEQ: !=
        Parameters:
        foundSet -
        predicate -
        Returns:
      • rangeLT

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeLT​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                       int predicate)
      • rangeLE

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeLE​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                       int predicate)
      • rangeGT

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeGT​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                       int predicate)
      • rangeGE

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap rangeGE​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                       int predicate)
      • range

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap range​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                     int start,
                                                                     int end)
      • compare

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap compare​(BitmapSliceIndex.Operation operation,
                                                                       int startOrValue,
                                                                       int end,
                                                                       org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)
        BSI Compare use single thread this Function compose algorithm from O'Neil and Owen Kaser the GE algorithm is from Owen since the performance is better. others are from O'Neil
        Parameters:
        operation -
        startOrValue - the start or value of comparison, when the comparison operation is range, it's start, when others,it's value.
        end - the end value of comparison. when the comparison operation is not range,the end = 0
        foundSet - columnId set we want compare,using RoaringBitmap to express
        Returns:
        columnId set we found in this bsi with giving conditions, using RoaringBitmap to express
      • sum

        public Pair<java.lang.Long,​java.lang.Long> sum​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)
      • toPairList

        public java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> toPairList()
      • toPairList

        public java.util.List<Pair<java.lang.Integer,​java.lang.Integer>> toPairList​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet)
      • parallelTransposeWithCount

        public MutableBitSliceIndex parallelTransposeWithCount​(org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                               int parallelism,
                                                               java.util.concurrent.ExecutorService pool)
                                                        throws java.util.concurrent.ExecutionException,
                                                               java.lang.InterruptedException
        TransposeWithCounts is a matrix transpose function that returns a BSI that has a columnID system defined by the values contained within the input BSI. Given that for BSIs, different columnIDs can have the same value. TransposeWithCounts is useful for situations where there is a one-to-many relationship between the vectored integer sets. The resulting BSI contains the number of times a particular value appeared in the input BSI as an integer count.
        Parameters:
        foundSet -
        Returns:
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • parallelIn

        public org.roaringbitmap.buffer.ImmutableRoaringBitmap parallelIn​(int parallelism,
                                                                          org.roaringbitmap.buffer.ImmutableRoaringBitmap foundSet,
                                                                          java.util.Set<java.lang.Integer> values,
                                                                          java.util.concurrent.ExecutorService pool)
                                                                   throws java.util.concurrent.ExecutionException,
                                                                          java.lang.InterruptedException
        parallelIn search the given Set values, we scan the bsi,if the value in values, we add it to result Bitmap
        Parameters:
        parallelism -
        foundSet -
        values -
        pool -
        Returns:
        Throws:
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
      • batchIn

        protected org.roaringbitmap.buffer.ImmutableRoaringBitmap batchIn​(int[] batch,
                                                                          java.util.Set<java.lang.Integer> values)