You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/14 03:05:51 UTC

[GitHub] [doris] yiguolei commented on a diff in pull request #10821: [improvement]Use phmap for aggregation with serialized key

yiguolei commented on code in PR #10821:
URL: https://github.com/apache/doris/pull/10821#discussion_r920709980


##########
be/src/vec/exec/vaggregation_node.cpp:
##########
@@ -1048,16 +1094,38 @@ Status AggregationNode::_merge_with_serialized_key(Block* block) {
     std::visit(
             [&](auto&& agg_method) -> void {
                 using HashMethodType = std::decay_t<decltype(agg_method)>;
+                using HashTableType = std::decay_t<decltype(agg_method.data)>;
                 using AggState = typename HashMethodType::State;
                 AggState state(key_columns, _probe_key_sz, nullptr);
 
                 _pre_serialize_key_if_need(state, agg_method, key_columns, rows);
 
+                std::vector<size_t> hash_values;
+
+                if constexpr (IsPhmapTraits<HashTableType>::value) {
+                    if (hash_values.size() < rows) hash_values.resize(rows);
+                    for (size_t i = 0; i < rows; ++i) {
+                        hash_values[i] = agg_method.data.hash(agg_method.keys[i]);
+                    }
+                }
+
                 /// For all rows.
                 for (size_t i = 0; i < rows; ++i) {
                     AggregateDataPtr aggregate_data = nullptr;
 
-                    auto emplace_result = state.emplace_key(agg_method.data, i, _agg_arena_pool);
+                    auto emplace_result = [&]() {
+                        if constexpr (IsPhmapTraits<HashTableType>::value) {
+                            if (LIKELY(i + HASH_MAP_PREFETCH_DIST < rows)) {
+                                agg_method.data.prefetch_by_hash(

Review Comment:
   Yes, ssb 3.x query performance is bad without prefetch.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org