Class TopNBatch

java.lang.Object
org.apache.drill.exec.record.AbstractRecordBatch<TopN>
org.apache.drill.exec.physical.impl.TopN.TopNBatch
All Implemented Interfaces:
AutoCloseable, Iterable<VectorWrapper<?>>, CloseableRecordBatch, RecordBatch, VectorAccessible

public class TopNBatch extends AbstractRecordBatch<TopN>
Operator Batch which implements the TopN functionality. It is more efficient than (sort + limit) since unlike sort it doesn't have to store all the input data to sort it first and then apply limit on the sorted data. Instead internally it maintains a priority queue backed by a heap with the size being same as limit value.