| 380 | } |
| 381 | |
| 382 | void Hashing32::HashMultiColumn(const std::vector<KeyColumnArray>& cols, |
| 383 | LightContext* ctx, uint32_t* hashes) { |
| 384 | uint32_t num_rows = static_cast<uint32_t>(cols[0].length()); |
| 385 | |
| 386 | constexpr uint32_t max_batch_size = util::MiniBatch::kMiniBatchLength; |
| 387 | |
| 388 | auto hash_temp_buf = util::TempVectorHolder<uint32_t>(ctx->stack, max_batch_size); |
| 389 | uint32_t* hash_temp = hash_temp_buf.mutable_data(); |
| 390 | |
| 391 | auto null_indices_buf = util::TempVectorHolder<uint16_t>(ctx->stack, max_batch_size); |
| 392 | uint16_t* null_indices = null_indices_buf.mutable_data(); |
| 393 | int num_null_indices; |
| 394 | |
| 395 | auto null_hash_temp_buf = util::TempVectorHolder<uint32_t>(ctx->stack, max_batch_size); |
| 396 | uint32_t* null_hash_temp = null_hash_temp_buf.mutable_data(); |
| 397 | |
| 398 | for (uint32_t first_row = 0; first_row < num_rows;) { |
| 399 | uint32_t batch_size_next = std::min(num_rows - first_row, max_batch_size); |
| 400 | |
| 401 | for (size_t icol = 0; icol < cols.size(); ++icol) { |
| 402 | if (cols[icol].metadata().is_null_type) { |
| 403 | if (icol == 0) { |
| 404 | for (uint32_t i = 0; i < batch_size_next; ++i) { |
| 405 | hashes[first_row + i] = 0; |
| 406 | } |
| 407 | } else { |
| 408 | for (uint32_t i = 0; i < batch_size_next; ++i) { |
| 409 | hashes[first_row + i] = CombineHashesImp(hashes[first_row + i], 0); |
| 410 | } |
| 411 | } |
| 412 | continue; |
| 413 | } |
| 414 | |
| 415 | // Get indices of null values within current minibatch |
| 416 | if (cols[icol].data(0)) { |
| 417 | util::bit_util::bits_to_indexes( |
| 418 | 0, ctx->hardware_flags, batch_size_next, cols[icol].data(0) + first_row / 8, |
| 419 | &num_null_indices, null_indices, first_row % 8 + cols[icol].bit_offset(0)); |
| 420 | // Make a backup copy of hash for nulls if needed |
| 421 | if (icol > 0) { |
| 422 | for (int i = 0; i < num_null_indices; ++i) { |
| 423 | null_hash_temp[i] = hashes[first_row + null_indices[i]]; |
| 424 | } |
| 425 | } |
| 426 | } |
| 427 | |
| 428 | if (cols[icol].metadata().is_fixed_length) { |
| 429 | uint32_t key_length = cols[icol].metadata().fixed_length; |
| 430 | if (key_length == 0) { |
| 431 | HashBit(icol > 0, cols[icol].bit_offset(1), batch_size_next, |
| 432 | cols[icol].data(1) + first_row / 8, hashes + first_row); |
| 433 | } else { |
| 434 | HashFixed(ctx->hardware_flags, icol > 0, batch_size_next, key_length, |
| 435 | cols[icol].data(1) + first_row * key_length, hashes + first_row, |
| 436 | hash_temp); |
| 437 | } |
| 438 | } else if (cols[icol].metadata().fixed_length == sizeof(uint32_t)) { |
| 439 | HashVarLen(ctx->hardware_flags, icol > 0, batch_size_next, |
nothing calls this directly
no test coverage detected