| 119 | } |
| 120 | |
| 121 | Status NestedLoopJoinNode::Prepare(RuntimeState* state) { |
| 122 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
| 123 | RETURN_IF_ERROR(BlockingJoinNode::Prepare(state)); |
| 124 | |
| 125 | RETURN_IF_ERROR(ScalarExprEvaluator::Create(join_conjuncts_, state, |
| 126 | pool_, expr_perm_pool(), expr_results_pool(), &join_conjunct_evals_)); |
| 127 | |
| 128 | if (!UseSeparateBuild(state->query_options())) { |
| 129 | RETURN_IF_ERROR(NljBuilder::CreateEmbeddedBuilder( |
| 130 | &build_row_desc(), state, id_, plan_node().tnode_->runtime_filters, &builder_)); |
| 131 | RETURN_IF_ERROR(builder_->Prepare(state, mem_tracker())); |
| 132 | runtime_profile()->PrependChild(builder_->profile()); |
| 133 | } |
| 134 | |
| 135 | // For some join modes we need to record the build rows with matches in a bitmap. |
| 136 | if (join_op_ == TJoinOp::RIGHT_ANTI_JOIN || join_op_ == TJoinOp::RIGHT_SEMI_JOIN |
| 137 | || join_op_ == TJoinOp::RIGHT_OUTER_JOIN || join_op_ == TJoinOp::FULL_OUTER_JOIN) { |
| 138 | if (num_children() == 2 |
| 139 | && child(1)->type() == TPlanNodeType::type::SINGULAR_ROW_SRC_NODE) { |
| 140 | // Allocate a fixed-size bitmap with a single element if we have a singular |
| 141 | // row source node as our build child. |
| 142 | int64_t bitmap_mem_usage = Bitmap::MemUsage(1); |
| 143 | if (!mem_tracker()->TryConsume(bitmap_mem_usage)) { |
| 144 | return mem_tracker()->MemLimitExceeded(state, |
| 145 | "Could not allocate bitmap in nested loop join", bitmap_mem_usage); |
| 146 | } |
| 147 | matching_build_rows_.reset(new Bitmap(1)); |
| 148 | } else { |
| 149 | // Allocate empty bitmap to be expanded later. |
| 150 | matching_build_rows_.reset(new Bitmap(0)); |
| 151 | } |
| 152 | } |
| 153 | prepare_succeeded_ = true; |
| 154 | return Status::OK(); |
| 155 | } |
| 156 | |
| 157 | Status NestedLoopJoinNode::Reset(RuntimeState* state, RowBatch* row_batch) { |
| 158 | builder_->Reset(); |
nothing calls this directly
no test coverage detected