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

Method ProbeSingleBatch

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

Source from the content-addressed store, hash-verified

492 }
493
494 Status ProbeSingleBatch(size_t thread_index, ExecBatch batch) override {
495 ThreadLocalState& local_state = local_states_[thread_index];
496 RETURN_NOT_OK(InitLocalStateIfNeeded(thread_index));
497
498 local_state.exec_batch_keys.Clear();
499
500 ExecBatch batch_key_for_lookups;
501
502 RETURN_NOT_OK(EncodeBatch(0, HashJoinProjection::KEY, &local_state.exec_batch_keys,
503 batch, &batch_key_for_lookups));
504 bool has_left_payload = (schema_[0]->num_cols(HashJoinProjection::PAYLOAD) > 0);
505 if (has_left_payload) {
506 local_state.exec_batch_payloads.Clear();
507 RETURN_NOT_OK(EncodeBatch(0, HashJoinProjection::PAYLOAD,
508 &local_state.exec_batch_payloads, batch));
509 }
510
511 local_state.match.clear();
512 local_state.no_match.clear();
513 local_state.match_left.clear();
514 local_state.match_right.clear();
515
516 bool use_key_batch_for_dicts = dict_probe_.BatchRemapNeeded(
517 thread_index, *schema_[0], *schema_[1], ctx_->exec_context());
518 RowEncoder* row_encoder_for_lookups = &local_state.exec_batch_keys;
519 if (use_key_batch_for_dicts) {
520 RETURN_NOT_OK(dict_probe_.EncodeBatch(
521 thread_index, *schema_[0], *schema_[1], dict_build_, batch,
522 &row_encoder_for_lookups, &batch_key_for_lookups, ctx_->exec_context()));
523 }
524
525 // Collect information about all nulls in key columns.
526 //
527 std::vector<const uint8_t*> non_null_bit_vectors;
528 std::vector<int64_t> non_null_bit_vector_offsets;
529 std::vector<uint8_t> all_nulls;
530 NullInfoFromBatch(batch_key_for_lookups, &non_null_bit_vectors,
531 &non_null_bit_vector_offsets, &all_nulls);
532
533 ProbeBatch_Lookup(&local_state, *row_encoder_for_lookups, non_null_bit_vectors,
534 non_null_bit_vector_offsets, &local_state.match,
535 &local_state.no_match, &local_state.match_left,
536 &local_state.match_right);
537
538 RETURN_NOT_OK(ProbeBatch_ResidualFilter(local_state, local_state.match,
539 local_state.no_match, local_state.match_left,
540 local_state.match_right));
541
542 for (auto i : local_state.match_right) {
543 // Mark row in hash table as having a match
544 bit_util::SetBit(local_state.has_match.data(), i);
545 }
546
547 RETURN_NOT_OK(ProbeBatch_OutputAll(thread_index, local_state.exec_batch_keys,
548 local_state.exec_batch_payloads, local_state.match,
549 local_state.no_match, local_state.match_left,
550 local_state.match_right));
551

Callers

nothing calls this directly

Calls 9

SetBitFunction · 0.85
num_colsMethod · 0.80
BatchRemapNeededMethod · 0.80
exec_contextMethod · 0.80
OKFunction · 0.50
ClearMethod · 0.45
clearMethod · 0.45
EncodeBatchMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected