We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8088706 commit 3d7f9caCopy full SHA for 3d7f9ca
clickhouse/types/type_parser.cpp
@@ -1,6 +1,8 @@
1
#include "type_parser.h"
2
#include "../base/string_utils.h"
3
4
+#include <map>
5
+#include <mutex>
6
#include <unordered_map>
7
8
namespace clickhouse {
@@ -167,8 +169,10 @@ const TypeAst* ParseTypeName(const std::string& type_name) {
167
169
// Cache for type_name.
168
170
// Usually we won't have too many type names in the cache, so do not try to
171
// limit cache size.
- static std::unordered_map<std::string, TypeAst> ast_cache;
172
+ static std::map<std::string, TypeAst> ast_cache;
173
+ static std::mutex lock;
174
175
+ std::lock_guard<std::mutex> guard(lock);
176
auto it = ast_cache.find(type_name);
177
if (it != ast_cache.end()) {
178
return &it->second;
0 commit comments