| 460 | } |
| 461 | |
| 462 | void NullInfoFromBatch(const ExecBatch& batch, |
| 463 | std::vector<const uint8_t*>* nn_bit_vectors, |
| 464 | std::vector<int64_t>* nn_offsets, |
| 465 | std::vector<uint8_t>* nn_bit_vector_all_nulls) { |
| 466 | int num_cols = static_cast<int>(batch.values.size()); |
| 467 | nn_bit_vectors->resize(num_cols); |
| 468 | nn_offsets->resize(num_cols); |
| 469 | nn_bit_vector_all_nulls->clear(); |
| 470 | for (int64_t i = 0; i < num_cols; ++i) { |
| 471 | const uint8_t* nn = nullptr; |
| 472 | int64_t offset = 0; |
| 473 | if (batch[i].is_array()) { |
| 474 | if (batch[i].array()->buffers[0] != NULLPTR) { |
| 475 | nn = batch[i].array()->buffers[0]->data(); |
| 476 | offset = batch[i].array()->offset; |
| 477 | } |
| 478 | } else { |
| 479 | ARROW_DCHECK(batch[i].is_scalar()); |
| 480 | if (!batch[i].scalar_as<arrow::internal::PrimitiveScalarBase>().is_valid) { |
| 481 | if (nn_bit_vector_all_nulls->empty()) { |
| 482 | nn_bit_vector_all_nulls->resize(bit_util::BytesForBits(batch.length)); |
| 483 | memset(nn_bit_vector_all_nulls->data(), 0, |
| 484 | bit_util::BytesForBits(batch.length)); |
| 485 | } |
| 486 | nn = nn_bit_vector_all_nulls->data(); |
| 487 | } |
| 488 | } |
| 489 | (*nn_bit_vectors)[i] = nn; |
| 490 | (*nn_offsets)[i] = offset; |
| 491 | } |
| 492 | } |
| 493 | |
| 494 | Status ProbeSingleBatch(size_t thread_index, ExecBatch batch) override { |
| 495 | ThreadLocalState& local_state = local_states_[thread_index]; |