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 0464380b18..35df772b16 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 #include +#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 - void prefetch(int current) { - if (LIKELY(current + HASH_MAP_PREFETCH_DIST < hash_values.size())) { - hash_table->template prefetch(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(keys[i + HASH_MAP_PREFETCH_DIST], + hash_values[i + HASH_MAP_PREFETCH_DIST]); } } template - auto find(State& state, size_t i) { + ALWAYS_INLINE auto find(State& state, size_t i) { prefetch(i); return state.find_key_with_hash(*hash_table, hash_values[i], keys[i]); } template - 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(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 37916ef240..0000000000 --- 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 -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 89958608c7..f23b0a347d 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 > using PartitionedHashMap = PartitionedHashMapTable>>; -template > -using PHPartitionedHashMap = PartitionedHashMapTable>; - template > using PHNormalHashMap = PHHashMap; - -template -struct HashTableTraits> { - static constexpr bool is_phmap = true; -}; - -template