Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add user parsing in HDFS URI #5946

Merged
merged 4 commits into from Jul 9, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions dbms/src/IO/HDFSCommon.cpp
Expand Up @@ -2,6 +2,7 @@

#if USE_HDFS
#include <Common/Exception.h>
#include <string.h>
namespace DB
{
namespace ErrorCodes
Expand All @@ -25,6 +26,13 @@ HDFSBuilderPtr createHDFSBuilder(const Poco::URI & uri)
hdfsBuilderConfSetStr(builder.get(), "input.write.timeout", "60000"); // 1 min
hdfsBuilderConfSetStr(builder.get(), "input.connect.timeout", "60000"); // 1 min

std::string userInfo = uri.getUserInfo();
if (!userInfo.empty() && userInfo.front() != ':') {
char *user = strtok(const_cast<char *> (userInfo.c_str()), ":");
akonyaev90 marked this conversation as resolved.
Show resolved Hide resolved
if (user != NULL) {
hdfsBuilderSetUserName(builder.get(), user);
}
}
hdfsBuilderSetNameNode(builder.get(), host.c_str());
hdfsBuilderSetNameNodePort(builder.get(), port);
return builder;
Expand Down