15 #ifndef IMPALA_RUNTIME_SORTER_H_
16 #define IMPALA_RUNTIME_SORTER_H_
23 class SortedRunMerger;
91 const std::vector<ExprContext*>& sort_tuple_slot_expr_ctxs,
120 int merge_batch_size);
std::vector< ExprContext * > sort_tuple_slot_expr_ctxs_
RuntimeProfile::Counter * num_merges_counter_
static uint64_t EstimateMergeMem(uint64_t available_blocks, RowDescriptor *row_desc, int merge_batch_size)
Status CreateMerger(int num_runs)
RuntimeProfile * profile_
Runtime profile and counters for this sorter instance.
RuntimeState *const state_
Runtime state instance used to check for cancellation. Not owned.
TupleRowComparator compare_less_than_
In memory sorter and less-than comparator.
RuntimeProfile::Counter * in_mem_sort_timer_
boost::scoped_ptr< TupleSorter > in_mem_tuple_sorter_
RuntimeProfile::Counter * sorted_data_size_
boost::scoped_ptr< SortedRunMerger > merger_
MemTracker * mem_tracker_
Mem tracker for batches created during merge. Not owned by Sorter.
Status AddBatch(RowBatch *batch)
Adds a batch of input rows to the current unsorted run.
RuntimeProfile::Counter * initial_runs_counter_
RowDescriptor * output_row_desc_
This class is thread-safe.
const RowDescriptor & row_desc() const
Status GetNext(RowBatch *batch, bool *eos)
Get the next batch of sorted output rows from the sorter.
std::list< Run * > sorted_runs_
Note that Init() must be called right after the constructor.
BufferedBlockMgr::Client * block_mgr_client_
Handle to block mgr to make allocations from.
Sorter(const TupleRowComparator &compare_less_than, const std::vector< ExprContext * > &sort_tuple_slot_expr_ctxs, RowDescriptor *output_row_desc, MemTracker *mem_tracker, RuntimeProfile *profile, RuntimeState *state)
std::list< Run * > merging_runs_
Status MergeIntermediateRuns()
ObjectPool obj_pool_
Pool of owned Run objects.
bool has_var_len_slots_
True if the tuples to be sorted have var-length slots.
BufferedBlockMgr * block_mgr_
Block manager object used to allocate, pin and release runs. Not owned by Sorter. ...