Class MSortTemplate
java.lang.Object
org.apache.drill.exec.physical.impl.xsort.MSortTemplate
- All Implemented Interfaces:
- MSorter,- org.apache.hadoop.util.IndexedSortable
- 
Field SummaryFields inherited from interface org.apache.drill.exec.physical.impl.xsort.MSorterTEMPLATE_DEFINITION
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidclear()intcompare(int leftIndex, int rightIndex) abstract intdoEval(int leftIndex, int rightIndex) abstract voiddoSetup(FragmentContext context, VectorContainer incoming, RecordBatch outgoing) getSV4()static longmemoryNeeded(int recordCount) For given recordCount how much memory does MSorter needs for its own purpose.protected intmerge(int leftStart, int rightStart, int rightEnd, int outStart) Given two regions within the selection vector 4 (a left and a right), merge the two regions to produce a combined output region in the auxiliary selection vector.voidsetup(FragmentContext context, BufferAllocator allocator, SelectionVector4 vector4, VectorContainer hyperBatch, int outputBatchSize, int desiredBatchSize) voidsort()Merge a set of pre-sorted runs to produce a combined result set.voidswap(int sv0, int sv1) 
- 
Constructor Details- 
MSortTemplatepublic MSortTemplate()
 
- 
- 
Method Details- 
setuppublic void setup(FragmentContext context, BufferAllocator allocator, SelectionVector4 vector4, VectorContainer hyperBatch, int outputBatchSize, int desiredBatchSize) throws SchemaChangeException - Specified by:
- setupin interface- MSorter
- Throws:
- SchemaChangeException
 
- 
memoryNeededpublic static long memoryNeeded(int recordCount) For given recordCount how much memory does MSorter needs for its own purpose. This is used in ExternalSortBatch to make decisions about whether to spill or not.
- 
mergeprotected int merge(int leftStart, int rightStart, int rightEnd, int outStart) Given two regions within the selection vector 4 (a left and a right), merge the two regions to produce a combined output region in the auxiliary selection vector.
- 
getSV4
- 
sortpublic void sort()Merge a set of pre-sorted runs to produce a combined result set. Merging is done in the selection vector, record data does not move.Runs are merge pairwise in multiple passes, providing performance of O(n * m * log(n)), where n = number of runs, m = number of records per run. 
- 
swappublic void swap(int sv0, int sv1) - Specified by:
- swapin interface- org.apache.hadoop.util.IndexedSortable
 
- 
comparepublic int compare(int leftIndex, int rightIndex) - Specified by:
- comparein interface- org.apache.hadoop.util.IndexedSortable
 
- 
clearpublic void clear()
- 
doSetuppublic abstract void doSetup(@Named("context") FragmentContext context, @Named("incoming") VectorContainer incoming, @Named("outgoing") RecordBatch outgoing) throws SchemaChangeException - Throws:
- SchemaChangeException
 
- 
doEvalpublic abstract int doEval(@Named("leftIndex") int leftIndex, @Named("rightIndex") int rightIndex) throws SchemaChangeException - Throws:
- SchemaChangeException
 
 
-