| 162 | } |
| 163 | |
| 164 | Status AnalyticEvalNode::Prepare(RuntimeState* state) { |
| 165 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
| 166 | RETURN_IF_ERROR(ExecNode::Prepare(state)); |
| 167 | DCHECK(child(0)->row_desc()->IsPrefixOf(*row_desc())); |
| 168 | DCHECK_GE(resource_profile_.min_reservation, |
| 169 | resource_profile_.spillable_buffer_size * MIN_REQUIRED_BUFFERS); |
| 170 | state_ = state; |
| 171 | curr_tuple_pool_.reset(new MemPool(mem_tracker())); |
| 172 | prev_tuple_pool_.reset(new MemPool(mem_tracker())); |
| 173 | prev_input_tuple_pool_.reset(new MemPool(mem_tracker())); |
| 174 | evaluation_timer_ = ADD_TIMER(runtime_profile(), "EvaluationTime"); |
| 175 | |
| 176 | DCHECK_EQ(result_tuple_desc_->slots().size(), analytic_fns_.size()); |
| 177 | RETURN_IF_ERROR(AggFnEvaluator::Create(analytic_fns_, state, pool_, expr_perm_pool(), |
| 178 | expr_results_pool(), &analytic_fn_evals_)); |
| 179 | |
| 180 | if (partition_by_eq_expr_ != nullptr) { |
| 181 | RETURN_IF_ERROR(ScalarExprEvaluator::Create(*partition_by_eq_expr_, state, pool_, |
| 182 | expr_perm_pool(), expr_results_pool(), &partition_by_eq_expr_eval_)); |
| 183 | } |
| 184 | |
| 185 | if (order_by_eq_expr_ != nullptr) { |
| 186 | RETURN_IF_ERROR(ScalarExprEvaluator::Create(*order_by_eq_expr_, state, pool_, |
| 187 | expr_perm_pool(), expr_results_pool(), &order_by_eq_expr_eval_)); |
| 188 | } |
| 189 | |
| 190 | // An intermediate tuple that is only allocated once and is reused. 'curr_tuple_' is |
| 191 | // initialized in Open() before it is used. |
| 192 | curr_tuple_ = |
| 193 | Tuple::Create(intermediate_tuple_desc_->byte_size(), expr_perm_pool_.get()); |
| 194 | dummy_result_tuple_ = |
| 195 | Tuple::Create(result_tuple_desc_->byte_size(), expr_perm_pool_.get()); |
| 196 | return Status::OK(); |
| 197 | } |
| 198 | |
| 199 | Status AnalyticEvalNode::Open(RuntimeState* state) { |
| 200 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
nothing calls this directly
no test coverage detected