MCPcopy Create free account
hub / github.com/apache/arrow / ProbeBatch_OutputOne

Method ProbeBatch_OutputOne

cpp/src/arrow/acero/hash_join.cc:188–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186 }
187
188 Status ProbeBatch_OutputOne(int64_t batch_size_next, ExecBatch* opt_left_key,
189 ExecBatch* opt_left_payload, ExecBatch* opt_right_key,
190 ExecBatch* opt_right_payload) {
191 ExecBatch result({}, batch_size_next);
192 int num_out_cols_left = schema_[0]->num_cols(HashJoinProjection::OUTPUT);
193 int num_out_cols_right = schema_[1]->num_cols(HashJoinProjection::OUTPUT);
194
195 result.values.resize(num_out_cols_left + num_out_cols_right);
196 auto from_key = schema_[0]->map(HashJoinProjection::OUTPUT, HashJoinProjection::KEY);
197 auto from_payload =
198 schema_[0]->map(HashJoinProjection::OUTPUT, HashJoinProjection::PAYLOAD);
199 for (int icol = 0; icol < num_out_cols_left; ++icol) {
200 bool is_from_key = (from_key.get(icol) != HashJoinProjectionMaps::kMissingField);
201 bool is_from_payload =
202 (from_payload.get(icol) != HashJoinProjectionMaps::kMissingField);
203 ARROW_DCHECK(is_from_key != is_from_payload);
204 ARROW_DCHECK(!is_from_key ||
205 (opt_left_key &&
206 from_key.get(icol) < static_cast<int>(opt_left_key->values.size()) &&
207 opt_left_key->length == batch_size_next));
208 ARROW_DCHECK(
209 !is_from_payload ||
210 (opt_left_payload &&
211 from_payload.get(icol) < static_cast<int>(opt_left_payload->values.size()) &&
212 opt_left_payload->length == batch_size_next));
213 result.values[icol] = is_from_key
214 ? opt_left_key->values[from_key.get(icol)]
215 : opt_left_payload->values[from_payload.get(icol)];
216 }
217 from_key = schema_[1]->map(HashJoinProjection::OUTPUT, HashJoinProjection::KEY);
218 from_payload =
219 schema_[1]->map(HashJoinProjection::OUTPUT, HashJoinProjection::PAYLOAD);
220 for (int icol = 0; icol < num_out_cols_right; ++icol) {
221 bool is_from_key = (from_key.get(icol) != HashJoinProjectionMaps::kMissingField);
222 bool is_from_payload =
223 (from_payload.get(icol) != HashJoinProjectionMaps::kMissingField);
224 ARROW_DCHECK(is_from_key != is_from_payload);
225 ARROW_DCHECK(!is_from_key ||
226 (opt_right_key &&
227 from_key.get(icol) < static_cast<int>(opt_right_key->values.size()) &&
228 opt_right_key->length == batch_size_next));
229 ARROW_DCHECK(
230 !is_from_payload ||
231 (opt_right_payload &&
232 from_payload.get(icol) < static_cast<int>(opt_right_payload->values.size()) &&
233 opt_right_payload->length == batch_size_next));
234 result.values[num_out_cols_left + icol] =
235 is_from_key ? opt_right_key->values[from_key.get(icol)]
236 : opt_right_payload->values[from_payload.get(icol)];
237 }
238
239 ARROW_RETURN_NOT_OK(output_batch_callback_(0, std::move(result)));
240
241 // Update the counter of produced batches
242 //
243 num_batches_produced_++;
244 return Status::OK();
245 }

Callers

nothing calls this directly

Calls 10

num_colsMethod · 0.80
resizeMethod · 0.80
mapMethod · 0.80
exec_contextMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
getMethod · 0.45
sizeMethod · 0.45
DecodeMethod · 0.45
PostDecodeMethod · 0.45

Tested by

no test coverage detected