Extract the bitmap addresses, and do an intersection.
| 492 | |
| 493 | /// Extract the bitmap addresses, and do an intersection. |
| 494 | void LLVMGenerator::ComputeBitMapsForExpr(const CompiledExpr& compiled_expr, |
| 495 | const SelectionVector* selection_vector, |
| 496 | EvalBatch* eval_batch) const { |
| 497 | auto validities = compiled_expr.value_validity()->validity_exprs(); |
| 498 | |
| 499 | // Extract all the source bitmap addresses. |
| 500 | BitMapAccumulator accumulator(*eval_batch); |
| 501 | for (auto& validity_dex : validities) { |
| 502 | validity_dex->Accept(accumulator); |
| 503 | } |
| 504 | |
| 505 | // Extract the destination bitmap address. |
| 506 | int out_idx = compiled_expr.output()->validity_idx(); |
| 507 | uint8_t* dst_bitmap = eval_batch->GetBuffer(out_idx); |
| 508 | // Compute the destination bitmap. |
| 509 | if (selection_vector == nullptr) { |
| 510 | accumulator.ComputeResult(dst_bitmap); |
| 511 | } else { |
| 512 | /// The output bitmap is an intersection of some input/local bitmaps. However, with a |
| 513 | /// selection vector, only the bits corresponding to the indices in the selection |
| 514 | /// vector need to set in the output bitmap. This is done in two steps : |
| 515 | /// |
| 516 | /// 1. Do the intersection of input/local bitmaps to generate a temporary bitmap. |
| 517 | /// 2. copy just the relevant bits from the temporary bitmap to the output bitmap. |
| 518 | LocalBitMapsHolder bit_map_holder(eval_batch->num_records(), 1); |
| 519 | uint8_t* temp_bitmap = bit_map_holder.GetLocalBitMap(0); |
| 520 | accumulator.ComputeResult(temp_bitmap); |
| 521 | |
| 522 | auto num_out_records = selection_vector->GetNumSlots(); |
| 523 | // the memset isn't required, doing it just for valgrind. |
| 524 | memset(dst_bitmap, 0, arrow::bit_util::BytesForBits(num_out_records)); |
| 525 | for (auto i = 0; i < num_out_records; ++i) { |
| 526 | auto bit = arrow::bit_util::GetBit(temp_bitmap, selection_vector->GetIndex(i)); |
| 527 | arrow::bit_util::SetBitTo(dst_bitmap, i, bit); |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | llvm::Value* LLVMGenerator::AddFunctionCall(const std::string& full_name, |
| 533 | llvm::Type* ret_type, |
nothing calls this directly
no test coverage detected