This is an automated email from the ASF dual-hosted git repository.

panxiaolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d7ea4d31fb8 [Chore](hash-table) remove unused code about 
HashTableTraits (#26202)
d7ea4d31fb8 is described below

commit d7ea4d31fb866500bbe18e567fe67291fa2396e4
Author: Pxl <[email protected]>
AuthorDate: Wed Nov 1 21:36:50 2023 +0800

    [Chore](hash-table) remove unused code about HashTableTraits (#26202)
    
    remove unused code about HashTableTraits
---
 be/src/vec/common/hash_table/hash_map_context.h    | 15 ++++++-----
 be/src/vec/common/hash_table/hash_table_utils.h    | 26 -------------------
 .../vec/common/hash_table/partitioned_hash_map.h   | 13 ----------
 .../vec/common/hash_table/partitioned_hash_table.h | 30 ++++++++--------------
 be/src/vec/common/hash_table/ph_hash_map.h         |  6 -----
 be/src/vec/common/hash_table/string_hash_table.h   |  1 -
 be/src/vec/exec/vaggregation_node.cpp              |  1 -
 7 files changed, 19 insertions(+), 73 deletions(-)

diff --git a/be/src/vec/common/hash_table/hash_map_context.h 
b/be/src/vec/common/hash_table/hash_map_context.h
index 0464380b18d..35df772b16d 100644
--- a/be/src/vec/common/hash_table/hash_map_context.h
+++ b/be/src/vec/common/hash_table/hash_map_context.h
@@ -20,6 +20,7 @@
 #include <type_traits>
 #include <utility>
 
+#include "common/compiler_util.h"
 #include "runtime/descriptors.h"
 #include "util/stack_util.h"
 #include "vec/columns/column_nullable.h"
@@ -85,6 +86,7 @@ struct MethodBase {
             hash_values[k] = hash_table->hash(keys[k]);
         }
     }
+
     void init_hash_values(size_t num_rows) {
         hash_values.resize(num_rows);
         for (size_t k = 0; k < num_rows; ++k) {
@@ -93,21 +95,22 @@ struct MethodBase {
     }
 
     template <bool read>
-    void prefetch(int current) {
-        if (LIKELY(current + HASH_MAP_PREFETCH_DIST < hash_values.size())) {
-            hash_table->template prefetch<read>(keys[current + 
HASH_MAP_PREFETCH_DIST],
-                                                hash_values[current + 
HASH_MAP_PREFETCH_DIST]);
+    ALWAYS_INLINE void prefetch(size_t i) {
+        if (LIKELY(i + HASH_MAP_PREFETCH_DIST < hash_values.size())) {
+            hash_table->template prefetch<read>(keys[i + 
HASH_MAP_PREFETCH_DIST],
+                                                hash_values[i + 
HASH_MAP_PREFETCH_DIST]);
         }
     }
 
     template <typename State>
-    auto find(State& state, size_t i) {
+    ALWAYS_INLINE auto find(State& state, size_t i) {
         prefetch<true>(i);
         return state.find_key_with_hash(*hash_table, hash_values[i], keys[i]);
     }
 
     template <typename State, typename F, typename FF>
-    auto& lazy_emplace(State& state, size_t i, F&& creator, FF&& 
creator_for_null_key) {
+    ALWAYS_INLINE auto& lazy_emplace(State& state, size_t i, F&& creator,
+                                     FF&& creator_for_null_key) {
         prefetch<false>(i);
         return state.lazy_emplace_key(*hash_table, i, keys[i], hash_values[i], 
creator,
                                       creator_for_null_key);
diff --git a/be/src/vec/common/hash_table/hash_table_utils.h 
b/be/src/vec/common/hash_table/hash_table_utils.h
deleted file mode 100644
index 37916ef2401..00000000000
--- a/be/src/vec/common/hash_table/hash_table_utils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-// This file is copied from
-// 
https://github.com/ClickHouse/ClickHouse/blob/master/src/Common/HashTable/HashTable.h
-// and modified by Doris
-
-#pragma once
-
-template <typename T>
-struct HashTableTraits {
-    static constexpr bool is_phmap = false;
-};
diff --git a/be/src/vec/common/hash_table/partitioned_hash_map.h 
b/be/src/vec/common/hash_table/partitioned_hash_map.h
index 89958608c73..f23b0a347de 100644
--- a/be/src/vec/common/hash_table/partitioned_hash_map.h
+++ b/be/src/vec/common/hash_table/partitioned_hash_map.h
@@ -55,18 +55,5 @@ template <typename Key, typename Mapped, typename Hash = 
DefaultHash<Key>>
 using PartitionedHashMap =
         PartitionedHashMapTable<HashMap<Key, Mapped, Hash, 
PartitionedHashTableGrower<>>>;
 
-template <typename Key, typename Mapped, typename Hash = DefaultHash<Key>>
-using PHPartitionedHashMap = PartitionedHashMapTable<PHHashMap<Key, Mapped, 
Hash, true>>;
-
 template <typename Key, typename Mapped, typename Hash = DefaultHash<Key>>
 using PHNormalHashMap = PHHashMap<Key, Mapped, Hash, false>;
-
-template <typename Key, typename Mapped, typename Hash>
-struct HashTableTraits<PHPartitionedHashMap<Key, Mapped, Hash>> {
-    static constexpr bool is_phmap = true;
-};
-
-template <template <typename> class Derived, typename Key, typename Mapped, 
typename Hash>
-struct HashTableTraits<Derived<PHPartitionedHashMap<Key, Mapped, Hash>>> {
-    static constexpr bool is_phmap = true;
-};
diff --git a/be/src/vec/common/hash_table/partitioned_hash_table.h 
b/be/src/vec/common/hash_table/partitioned_hash_table.h
index 88437522cd3..c7626f1fc84 100644
--- a/be/src/vec/common/hash_table/partitioned_hash_table.h
+++ b/be/src/vec/common/hash_table/partitioned_hash_table.h
@@ -20,7 +20,6 @@
 #pragma once
 
 #include "vec/common/hash_table/hash_table.h"
-#include "vec/common/hash_table/hash_table_utils.h"
 
 /** Partitioned hash table.
   * Represents 16 (or 1ULL << BITS_FOR_SUB_TABLE) small hash tables (sub table 
count of the first level).
@@ -539,26 +538,17 @@ private:
 
         auto it = level0_sub_table.begin();
 
-        if constexpr (HashTableTraits<Impl>::is_phmap) {
-            for (; it != level0_sub_table.end(); ++it) {
-                size_t hash_value = level0_sub_table.hash(it.get_first());
-                size_t sub_table_idx = get_sub_table_from_hash(hash_value);
-                level1_sub_tables[sub_table_idx].insert(it.get_first(), 
hash_value,
-                                                        it.get_second());
-            }
-        } else {
-            /// It is assumed that the zero key (stored separately) is first 
in iteration order.
-            if (it != level0_sub_table.end() && 
it.get_ptr()->is_zero(level0_sub_table)) {
-                insert(it->get_value());
-                ++it;
-            }
+        /// It is assumed that the zero key (stored separately) is first in 
iteration order.
+        if (it != level0_sub_table.end() && 
it.get_ptr()->is_zero(level0_sub_table)) {
+            insert(it->get_value());
+            ++it;
+        }
 
-            for (; it != level0_sub_table.end(); ++it) {
-                const auto* cell = it.get_ptr();
-                size_t hash_value = cell->get_hash(level0_sub_table);
-                size_t sub_table_idx = get_sub_table_from_hash(hash_value);
-                level1_sub_tables[sub_table_idx].insert_unique_non_zero(cell, 
hash_value);
-            }
+        for (; it != level0_sub_table.end(); ++it) {
+            const auto* cell = it.get_ptr();
+            size_t hash_value = cell->get_hash(level0_sub_table);
+            size_t sub_table_idx = get_sub_table_from_hash(hash_value);
+            level1_sub_tables[sub_table_idx].insert_unique_non_zero(cell, 
hash_value);
         }
 
         level0_sub_table.clear_and_shrink();
diff --git a/be/src/vec/common/hash_table/ph_hash_map.h 
b/be/src/vec/common/hash_table/ph_hash_map.h
index dbd506cc390..f1db30f41a5 100644
--- a/be/src/vec/common/hash_table/ph_hash_map.h
+++ b/be/src/vec/common/hash_table/ph_hash_map.h
@@ -24,7 +24,6 @@
 
 #include "vec/aggregate_functions/aggregate_function.h"
 #include "vec/common/hash_table/hash.h"
-#include "vec/common/hash_table/hash_table_utils.h"
 #include "vec/common/hash_table/phmap_fwd_decl.h"
 
 template <typename Key, typename Mapped>
@@ -270,8 +269,3 @@ private:
     // PartitionedHashTable will convert this hash table to partitioned hash 
table
     bool _need_partition;
 };
-
-template <typename Key, typename Mapped, typename Hash, bool 
PartitionedHashTable>
-struct HashTableTraits<PHHashMap<Key, Mapped, Hash, PartitionedHashTable>> {
-    static constexpr bool is_phmap = true;
-};
diff --git a/be/src/vec/common/hash_table/string_hash_table.h 
b/be/src/vec/common/hash_table/string_hash_table.h
index 00bbf2f02f8..c2916c58baa 100644
--- a/be/src/vec/common/hash_table/string_hash_table.h
+++ b/be/src/vec/common/hash_table/string_hash_table.h
@@ -24,7 +24,6 @@
 #include <variant>
 
 #include "vec/common/hash_table/hash.h"
-#include "vec/common/hash_table/hash_table_utils.h"
 
 using StringKey8 = doris::vectorized::UInt64;
 using StringKey16 = doris::vectorized::UInt128;
diff --git a/be/src/vec/exec/vaggregation_node.cpp 
b/be/src/vec/exec/vaggregation_node.cpp
index 89a97998b76..243c85b06e4 100644
--- a/be/src/vec/exec/vaggregation_node.cpp
+++ b/be/src/vec/exec/vaggregation_node.cpp
@@ -41,7 +41,6 @@
 #include "vec/aggregate_functions/aggregate_function.h"
 #include "vec/common/hash_table/hash.h"
 #include "vec/common/hash_table/hash_map_context_creator.h"
-#include "vec/common/hash_table/hash_table_utils.h"
 #include "vec/common/hash_table/partitioned_hash_map.h"
 #include "vec/common/hash_table/string_hash_table.h"
 #include "vec/common/string_buffer.hpp"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to