Interface PriorityQueue

All Known Implementing Classes:
PriorityQueueTemplate

public interface PriorityQueue
  • Field Details

  • Method Details

    • add

      void add(RecordBatchData batch) throws SchemaChangeException
      The elements in the given batch are added to the priority queue. Note that the priority queue only retains the top elements that fit within the size specified by the init(int, BufferAllocator, boolean) method.
      Parameters:
      batch - The batch containing elements we want to add.
      Throws:
      SchemaChangeException
    • init

      void init(int limit, BufferAllocator allocator, boolean hasSv2) throws SchemaChangeException
      Initializes the priority queue. This method must be called before any other methods on the priority queue are called.
      Parameters:
      limit - The size of the priority queue.
      allocator - The BufferAllocator to use when creating the priority queue.
      hasSv2 - True when incoming batches have 2 byte selection vectors. False otherwise.
      Throws:
      SchemaChangeException
    • generate

      void generate()
      This method must be called before fetching the final priority queue hyper batch and final Sv4 vector.
      Throws:
      SchemaChangeException
    • getHyperBatch

      VectorContainer getHyperBatch()
      Retrieves the final priority queue HyperBatch containing the results. Note: this should be called after generate().
      Returns:
      The final priority queue HyperBatch containing the results.
    • getSv4

    • getFinalSv4

      SelectionVector4 getFinalSv4()
      Retrieves the selection vector used to select the elements in the priority queue from the hyper batch provided by the getHyperBatch() method. Note: this should be called after generate().
      Returns:
      The selection vector used to select the elements in the priority queue.
    • resetQueue

      void resetQueue(VectorContainer container, SelectionVector4 vector4) throws SchemaChangeException
      Cleanup the old state of queue and recreate a new one with HyperContainer containing vectors in input container and the corresponding indexes (in SV4 format) from input SelectionVector4
      Parameters:
      container -
      vector4 -
      Throws:
      SchemaChangeException
    • cleanup

      void cleanup()
      Releases all the memory consumed by the priority queue.
    • isInitialized

      boolean isInitialized()