MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / updateStatistics

Function updateStatistics

src/Interpreters/ConcurrentHashJoin.cpp:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73using BlockHashes = std::vector<UInt64>;
74
75void 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
93UInt32 toPowerOfTwo(UInt32 x)
94{

Callers 1

~ConcurrentHashJoinMethod · 0.70

Calls 8

getJoinedDataMethod · 0.80
ExceptionClass · 0.70
getTotalRowCountMethod · 0.45
atMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected