mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #5946 from akonyaev90/add_user_parsing_in_HDFS_uri
WIP: add user parsing in HDFS URI
This commit is contained in:
commit
97b75fe343
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#if USE_HDFS
|
#if USE_HDFS
|
||||||
#include <Common/Exception.h>
|
#include <Common/Exception.h>
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
namespace ErrorCodes
|
namespace ErrorCodes
|
||||||
@ -9,6 +10,7 @@ namespace ErrorCodes
|
|||||||
extern const int BAD_ARGUMENTS;
|
extern const int BAD_ARGUMENTS;
|
||||||
extern const int NETWORK_ERROR;
|
extern const int NETWORK_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri)
|
HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri)
|
||||||
{
|
{
|
||||||
auto & host = uri.getHost();
|
auto & host = uri.getHost();
|
||||||
@ -25,6 +27,18 @@ HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri)
|
|||||||
hdfsBuilderConfSetStr(builder.get(), "input.write.timeout", "60000"); // 1 min
|
hdfsBuilderConfSetStr(builder.get(), "input.write.timeout", "60000"); // 1 min
|
||||||
hdfsBuilderConfSetStr(builder.get(), "input.connect.timeout", "60000"); // 1 min
|
hdfsBuilderConfSetStr(builder.get(), "input.connect.timeout", "60000"); // 1 min
|
||||||
|
|
||||||
|
std::string user_info = uri.getUserInfo();
|
||||||
|
if (!user_info.empty() && user_info.front() != ':')
|
||||||
|
{
|
||||||
|
std::string user;
|
||||||
|
size_t delim_pos = user_info.find(":");
|
||||||
|
if (delim_pos != std::string::npos)
|
||||||
|
user = user_info.substr(0, delim_pos);
|
||||||
|
else
|
||||||
|
user = user_info;
|
||||||
|
|
||||||
|
hdfsBuilderSetUserName(builder.get(), user.c_str());
|
||||||
|
}
|
||||||
hdfsBuilderSetNameNode(builder.get(), host.c_str());
|
hdfsBuilderSetNameNode(builder.get(), host.c_str());
|
||||||
hdfsBuilderSetNameNodePort(builder.get(), port);
|
hdfsBuilderSetNameNodePort(builder.get(), port);
|
||||||
return builder;
|
return builder;
|
||||||
|
Loading…
Reference in New Issue
Block a user