| 73 | using BlockHashes = std::vector<UInt64>; |
| 74 | |
| 75 | void updateStatistics(const auto & hash_joins, const DB::StatsCollectingParams & params) |
| 76 | { |
| 77 | if (!params.isCollectionAndUseEnabled()) |
| 78 | return; |
| 79 | |
| 80 | const auto ht_size = hash_joins.at(0)->data->getTotalRowCount(); |
| 81 | if (!std::ranges::all_of(hash_joins, [&](const auto & hash_join) { return hash_join->data->getTotalRowCount() == ht_size; })) |
| 82 | throw DB::Exception(DB::ErrorCodes::LOGICAL_ERROR, "HashJoin instances have different sizes"); |
| 83 | |
| 84 | const auto source_rows = std::accumulate( |
| 85 | hash_joins.begin(), |
| 86 | hash_joins.end(), |
| 87 | 0ull, |
| 88 | [](auto acc, const auto & hash_join) { return acc + hash_join->data->getJoinedData()->rows_to_join; }); |
| 89 | if (ht_size) |
| 90 | DB::getHashTablesStatistics<DB::HashJoinEntry>().update({.ht_size = ht_size, .source_rows = source_rows}, params); |
| 91 | } |
| 92 | |
| 93 | UInt32 toPowerOfTwo(UInt32 x) |
| 94 | { |
no test coverage detected