| 765 | } |
| 766 | |
| 767 | inline int64_t AnalyticEvalNode::NumOutputRowsReady() const { |
| 768 | if (result_tuples_.empty()) return 0; |
| 769 | int64_t rows_to_return = last_result_idx_ - input_stream_->rows_returned(); |
| 770 | if (last_result_idx_ > input_stream_->num_rows()) { |
| 771 | // This happens when we were able to add a result tuple before consuming child rows, |
| 772 | // e.g. initializing a new partition with an end bound that is X preceding. The first |
| 773 | // X rows get the default value and we add that tuple to result_tuples_ before |
| 774 | // consuming child rows. It's possible the result is negative, and that's fine |
| 775 | // because this result is only used to determine if the number of rows to return |
| 776 | // is at least as big as the batch size. |
| 777 | rows_to_return -= last_result_idx_ - input_stream_->num_rows(); |
| 778 | } else { |
| 779 | DCHECK_GE(rows_to_return, 0); |
| 780 | } |
| 781 | return rows_to_return; |
| 782 | } |
| 783 | |
| 784 | Status AnalyticEvalNode::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) { |
| 785 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
nothing calls this directly
no test coverage detected