Interface PriorityQueue
- All Known Implementing Classes:
PriorityQueueTemplate
public interface PriorityQueue
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(RecordBatchData batch) The elements in the given batch are added to the priority queue.void
cleanup()
Releases all the memory consumed by the priority queue.void
generate()
This method must be called before fetching the final priority queue hyper batch and final Sv4 vector.Retrieves the selection vector used to select the elements in the priority queue from the hyper batch provided by thegetHyperBatch()
method.Retrieves the final priority queue HyperBatch containing the results.getSv4()
void
init
(int limit, BufferAllocator allocator, boolean hasSv2) Initializes the priority queue.boolean
void
resetQueue
(VectorContainer container, SelectionVector4 vector4) 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
-
Field Details
-
TEMPLATE_DEFINITION
-
-
Method Details
-
add
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 theinit(int, BufferAllocator, boolean)
method.- Parameters:
batch
- The batch containing elements we want to add.- Throws:
SchemaChangeException
-
init
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
- TheBufferAllocator
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 aftergenerate()
.- Returns:
- The final priority queue HyperBatch containing the results.
-
getSv4
SelectionVector4 getSv4() -
getFinalSv4
SelectionVector4 getFinalSv4()Retrieves the selection vector used to select the elements in the priority queue from the hyper batch provided by thegetHyperBatch()
method. Note: this should be called aftergenerate()
.- Returns:
- The selection vector used to select the elements in the priority queue.
-
resetQueue
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()
-