From 9e1208a79389172ee95523a02722d0791860589a Mon Sep 17 00:00:00 2001 From: HarryLeeIBM Date: Mon, 2 Oct 2023 15:20:35 -0700 Subject: [PATCH] Speed up inverted index building using flat_hash_map --- src/Common/FST.h | 6 +++--- src/Storages/MergeTree/GinIndexStore.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Common/FST.h b/src/Common/FST.h index 64c3c8853f6..7e51b807303 100644 --- a/src/Common/FST.h +++ b/src/Common/FST.h @@ -3,13 +3,13 @@ #include #include #include -#include #include #include #include #include #include #include +#include namespace DB { @@ -107,7 +107,7 @@ public: UInt64 state_index = 0; /// Arcs which are started from state, the 'char' is the label on the arc - std::unordered_map arcs; + absl::flat_hash_map arcs; private: struct FlagValues @@ -146,7 +146,7 @@ private: StatePtr initial_state; /// map of (state_hash, StatePtr) - std::unordered_map minimized_states; + absl::flat_hash_map minimized_states; /// Next available ID of state UInt64 next_id = 1; diff --git a/src/Storages/MergeTree/GinIndexStore.h b/src/Storages/MergeTree/GinIndexStore.h index cf6ce2e8625..b86de546ecb 100644 --- a/src/Storages/MergeTree/GinIndexStore.h +++ b/src/Storages/MergeTree/GinIndexStore.h @@ -11,6 +11,7 @@ #include #include #include +#include /// GinIndexStore manages the generalized inverted index ("gin") for a data part, and it is made up of one or more immutable /// index segments. @@ -124,7 +125,7 @@ class GinIndexStore { public: /// Container for all term's Gin Index Postings List Builder - using GinIndexPostingsBuilderContainer = std::unordered_map; + using GinIndexPostingsBuilderContainer = absl::flat_hash_map; GinIndexStore(const String & name_, DataPartStoragePtr storage_); GinIndexStore(const String & name_, DataPartStoragePtr storage_, MutableDataPartStoragePtr data_part_storage_builder_, UInt64 max_digestion_size_);