mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
add user parsing in HDFS URI (rewrite split boost->std::string)
This commit is contained in:
parent
c0dc8fc9d3
commit
54d890b984
@ -2,8 +2,6 @@
|
||||
|
||||
#if USE_HDFS
|
||||
#include <Common/Exception.h>
|
||||
#include <boost/algorithm/string/split.hpp>
|
||||
#include <boost/algorithm/string/classification.hpp>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -31,13 +29,17 @@ HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri)
|
||||
std::string userInfo = uri.getUserInfo();
|
||||
if (!userInfo.empty() && userInfo.front() != ':')
|
||||
{
|
||||
std::vector<std::string> splitRes;
|
||||
boost::split(splitRes, userInfo, boost::algorithm::is_any_of(":"), boost::algorithm::token_compress_on);
|
||||
const char *user = splitRes.front().c_str();
|
||||
if (user)
|
||||
std::string user;
|
||||
size_t delimPos = userInfo.find(":");
|
||||
if (delimPos != std::string::npos)
|
||||
{
|
||||
hdfsBuilderSetUserName(builder.get(), user);
|
||||
user = userInfo.substr(0, delimPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
user = userInfo;
|
||||
}
|
||||
hdfsBuilderSetUserName(builder.get(), user.c_str());
|
||||
}
|
||||
hdfsBuilderSetNameNode(builder.get(), host.c_str());
|
||||
hdfsBuilderSetNameNodePort(builder.get(), port);
|
||||
|
Loading…
Reference in New Issue
Block a user