@@ -48,7 +48,7 @@ VSortedRunMerger::VSortedRunMerger(const VExprContextSPtrs& ordering_expr,
4848 _batch_size(batch_size),
4949 _limit(limit),
5050 _offset(offset) {
51- init_timers (profile);
51+ _init_timers (profile);
5252}
5353
5454VSortedRunMerger::VSortedRunMerger (const SortDescription& desc, const size_t batch_size,
@@ -60,10 +60,10 @@ VSortedRunMerger::VSortedRunMerger(const SortDescription& desc, const size_t bat
6060 _offset(offset),
6161 _get_next_timer(nullptr ),
6262 _get_next_block_timer(nullptr ) {
63- init_timers (profile);
63+ _init_timers (profile);
6464}
6565
66- void VSortedRunMerger::init_timers (RuntimeProfile* profile) {
66+ void VSortedRunMerger::_init_timers (RuntimeProfile* profile) {
6767 _get_next_timer = ADD_TIMER (profile, " MergeGetNext" );
6868 _get_next_block_timer = ADD_TIMER (profile, " MergeGetNextBlock" );
6969}
@@ -97,15 +97,15 @@ Status VSortedRunMerger::prepare(const vector<BlockSupplier>& input_runs) {
9797 return Status::OK ();
9898}
9999
100- Status VSortedRunMerger::get_next (Block* output_block, bool * eos) {
100+ Status VSortedRunMerger::_get_next_internal (Block* output_block, bool * eos) {
101101 ScopedTimer<MonotonicStopWatch> timer (_get_next_timer);
102102 // Only have one receive data queue of data, no need to do merge and
103103 // copy the data of block.
104104 // return the data in receive data directly
105105
106106 if (_pending_cursor != nullptr ) {
107107 MergeSortCursor cursor (_pending_cursor);
108- if (has_next_block (cursor)) {
108+ if (_has_next_block (cursor)) {
109109 _priority_queue.push (cursor);
110110 }
111111 _pending_cursor = nullptr ;
@@ -124,7 +124,7 @@ Status VSortedRunMerger::get_next(Block* output_block, bool* eos) {
124124 _priority_queue.pop ();
125125 return Status::OK ();
126126 }
127- has_next_block (current);
127+ _has_next_block (current);
128128 } else {
129129 current->pos += _offset;
130130 _offset = 0 ;
@@ -139,7 +139,7 @@ Status VSortedRunMerger::get_next(Block* output_block, bool* eos) {
139139 _priority_queue.pop ();
140140 return Status::OK ();
141141 }
142- *eos = !has_next_block (current);
142+ *eos = !_has_next_block (current);
143143 } else {
144144 *eos = true ;
145145 }
@@ -156,7 +156,7 @@ Status VSortedRunMerger::get_next(Block* output_block, bool* eos) {
156156 _priority_queue.pop ();
157157 return Status::OK ();
158158 }
159- *eos = !has_next_block (current);
159+ *eos = !_has_next_block (current);
160160 } else {
161161 *eos = true ;
162162 }
@@ -190,7 +190,7 @@ Status VSortedRunMerger::get_next(Block* output_block, bool* eos) {
190190 }
191191
192192 // In pipeline engine, needs to check if the sender is readable before the next reading.
193- if (!next_heap (current)) {
193+ if (!_next_heap (current)) {
194194 return Status::OK ();
195195 }
196196
@@ -213,21 +213,25 @@ Status VSortedRunMerger::get_next(Block* output_block, bool* eos) {
213213 return Status::OK ();
214214}
215215
216- bool VSortedRunMerger::next_heap (MergeSortCursor& current) {
216+ Status VSortedRunMerger::get_next (Block* output_block, bool * eos) {
217+ RETURN_IF_CATCH_EXCEPTION (return _get_next_internal (output_block, eos));
218+ }
219+
220+ bool VSortedRunMerger::_next_heap (MergeSortCursor& current) {
217221 if (!current->isLast ()) {
218222 current->next ();
219223 _priority_queue.push (current);
220224 } else if (_pipeline_engine_enabled) {
221225 // need to check sender is readable again before the next reading.
222226 _pending_cursor = current.impl ;
223227 return false ;
224- } else if (has_next_block (current)) {
228+ } else if (_has_next_block (current)) {
225229 _priority_queue.push (current);
226230 }
227231 return true ;
228232}
229233
230- inline bool VSortedRunMerger::has_next_block (doris::vectorized::MergeSortCursor& current) {
234+ inline bool VSortedRunMerger::_has_next_block (doris::vectorized::MergeSortCursor& current) {
231235 ScopedTimer<MonotonicStopWatch> timer (_get_next_block_timer);
232236 return current->has_next_block ();
233237}
0 commit comments