| 139 | } |
| 140 | |
| 141 | Status PartitionedHashJoinNode::Prepare(RuntimeState* state) { |
| 142 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
| 143 | |
| 144 | RETURN_IF_ERROR(BlockingJoinNode::Prepare(state)); |
| 145 | runtime_state_ = state; |
| 146 | if (!UseSeparateBuild(state->query_options())) { |
| 147 | const PhjBuilderConfig& builder_config = |
| 148 | *static_cast<const PartitionedHashJoinPlanNode&>(plan_node_).phj_builder_config_; |
| 149 | builder_ = builder_config.CreateSink(buffer_pool_client(), |
| 150 | resource_profile_.spillable_buffer_size, resource_profile_.max_row_buffer_size, |
| 151 | state); |
| 152 | RETURN_IF_ERROR(builder_->Prepare(state, mem_tracker())); |
| 153 | runtime_profile()->PrependChild(builder_->profile()); |
| 154 | } |
| 155 | |
| 156 | RETURN_IF_ERROR(ScalarExprEvaluator::Create(other_join_conjuncts_, state, pool_, |
| 157 | expr_perm_pool(), expr_results_pool(), &other_join_conjunct_evals_)); |
| 158 | |
| 159 | probe_expr_results_pool_.reset(new MemPool(mem_tracker())); |
| 160 | |
| 161 | // We have to carefully set up expression evaluators in the HashTableCtx to use |
| 162 | // MemPools with appropriate lifetime. The values of build exprs are only used |
| 163 | // temporarily while processing each build batch or when processing a probe row |
| 164 | // so can be stored in 'expr_results_pool_', which is freed during |
| 165 | // QueryMaintenance(). Values of probe exprs may need to live longer until the |
| 166 | // cache is reset so are stored in 'probe_expr_results_pool_', which is cleared |
| 167 | // manually at the appropriate time. |
| 168 | RETURN_IF_ERROR(HashTableCtx::Create(pool_, state, hash_table_config_, hash_seed(), |
| 169 | MAX_PARTITION_DEPTH, build_row_desc().tuple_descriptors().size(), expr_perm_pool(), |
| 170 | expr_results_pool(), probe_expr_results_pool_.get(), &ht_ctx_)); |
| 171 | if (join_op_ == TJoinOp::NULL_AWARE_LEFT_ANTI_JOIN) { |
| 172 | null_aware_eval_timer_ = ADD_TIMER(runtime_profile(), "NullAwareAntiJoinEvalTime"); |
| 173 | } |
| 174 | |
| 175 | num_probe_rows_partitioned_ = |
| 176 | ADD_COUNTER(runtime_profile(), "ProbeRowsPartitioned", TUnit::UNIT); |
| 177 | prepare_succeeded_ = true; |
| 178 | return Status::OK(); |
| 179 | } |
| 180 | |
| 181 | void PartitionedHashJoinPlanNode::Codegen(FragmentState* state) { |
| 182 | DCHECK(state->ShouldCodegen()); |
nothing calls this directly
no test coverage detected