mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
fixed map issue
This commit is contained in:
parent
e4e23d73ea
commit
61e7054f1f
@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
#include <Poco/Util/AbstractConfiguration.h>
|
||||
#include <Common/Macros.h>
|
||||
@ -37,16 +38,9 @@ Macros::Macros(const Poco::Util::AbstractConfiguration & config, const String &
|
||||
}
|
||||
}
|
||||
|
||||
Macros::Macros(std::map<const String, const String> map)
|
||||
Macros::Macros(std::map<String, String> map)
|
||||
{
|
||||
for (const auto& pair : map) {
|
||||
const String& key = pair.first;
|
||||
const String& value = pair.second;
|
||||
macros[key] = value;
|
||||
|
||||
if (key == "database" || key == "table" || key == "uuid")
|
||||
enable_special_macros = false;
|
||||
}
|
||||
macros = std::move(map);
|
||||
}
|
||||
|
||||
String Macros::expand(const String & s,
|
||||
|
@ -27,7 +27,7 @@ class Macros
|
||||
public:
|
||||
Macros() = default;
|
||||
Macros(const Poco::Util::AbstractConfiguration & config, const String & key, Poco::Logger * log = nullptr);
|
||||
explicit Macros(std::map<const String, const String> map);
|
||||
explicit Macros(std::map<String, String> map);
|
||||
|
||||
struct MacroExpansionInfo
|
||||
{
|
||||
|
@ -25,9 +25,7 @@ struct URIConverter
|
||||
{
|
||||
static void modifyURI(Poco::URI & uri, std::unordered_map<std::string, std::string> mapper)
|
||||
{
|
||||
std::map<const String, const String> macros_map;
|
||||
macros_map.try_emplace("bucket", uri.getHost());
|
||||
Macros macros(macros_map);
|
||||
Macros macros({{"bucket", uri.getHost()}});
|
||||
uri = macros.expand(mapper[uri.getScheme()]).empty()? uri : Poco::URI(macros.expand(mapper[uri.getScheme()]) + "/" + uri.getPathAndQuery());
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user