| 1457 | |
| 1458 | template <bool ignoreNullKeys> |
| 1459 | bool HashTable<ignoreNullKeys>::analyze() { |
| 1460 | constexpr int32_t kHashBatchSize = 1024; |
| 1461 | // @lint-ignore CLANGTIDY |
| 1462 | char* groups[kHashBatchSize]; |
| 1463 | RowContainerIterator iterator; |
| 1464 | int32_t numGroups; |
| 1465 | do { |
| 1466 | numGroups = rows_->listRows(&iterator, kHashBatchSize, groups); |
| 1467 | for (int32_t i = 0; i < hashers_.size(); ++i) { |
| 1468 | auto& hasher = hashers_[i]; |
| 1469 | if (!hasher->isRange()) { |
| 1470 | // A range mode hasher does not know distincts, so need to |
| 1471 | // look. A distinct mode one does know the range. A hash join |
| 1472 | // build is always analyzed. |
| 1473 | continue; |
| 1474 | } |
| 1475 | uint64_t rangeSize; |
| 1476 | uint64_t distinctSize; |
| 1477 | hasher->cardinality(0, rangeSize, distinctSize); |
| 1478 | if (distinctSize == VectorHasher::kRangeTooLarge && |
| 1479 | rangeSize == VectorHasher::kRangeTooLarge) { |
| 1480 | return false; |
| 1481 | } |
| 1482 | RowColumn column = rows_->columnAt(i); |
| 1483 | hasher->analyze( |
| 1484 | groups, |
| 1485 | numGroups, |
| 1486 | column.offset(), |
| 1487 | ignoreNullKeys ? 0 : column.nullByte(), |
| 1488 | ignoreNullKeys ? 0 : column.nullMask()); |
| 1489 | } |
| 1490 | } while (numGroups > 0); |
| 1491 | return true; |
| 1492 | } |
| 1493 | |
| 1494 | namespace { |
| 1495 | // Multiplies a * b and produces uint64_t max to denote overflow. If |
no test coverage detected