Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 6e14384

Browse files
kouwesm
authored andcommitted
ARROW-7841: [C++] Use ${HADOOP_HOME}/lib/native/ to find libhdfs.so again
This is a regression bug of e12d285 . Closes apache#6424 from kou/cpp-hdfs-fix-path and squashes the following commits: 6d5f651 <Sutou Kouhei> ARROW-7841: Use ${HADOOP_HOME}/lib/native/ to find libhdfs.so again Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Wes McKinney <wesm+git@apache.org>
1 parent 9392531 commit 6e14384

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cpp/src/arrow/io/hdfs_internal.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ void AppendEnvVarFilename(const char* var_name,
117117
}
118118
}
119119

120+
void AppendEnvVarFilename(const char* var_name, const char* suffix,
121+
std::vector<PlatformFilename>* filenames) {
122+
auto maybe_env_var = GetEnvVarNative(var_name);
123+
if (maybe_env_var.ok()) {
124+
auto maybe_env_var_with_suffix =
125+
PlatformFilename(std::move(*maybe_env_var)).Join(suffix);
126+
if (maybe_env_var_with_suffix.ok()) {
127+
filenames->emplace_back(std::move(*maybe_env_var_with_suffix));
128+
}
129+
}
130+
}
131+
120132
void InsertEnvVarFilename(const char* var_name,
121133
std::vector<PlatformFilename>* filenames) {
122134
auto maybe_env_var = GetEnvVarNative(var_name);
@@ -142,7 +154,7 @@ Result<std::vector<PlatformFilename>> get_potential_libhdfs_paths() {
142154
ARROW_ASSIGN_OR_RAISE(auto search_paths, MakeFilenameVector({"", "."}));
143155

144156
// Path from environment variable
145-
AppendEnvVarFilename("HADOOP_HOME", &search_paths);
157+
AppendEnvVarFilename("HADOOP_HOME", "lib/native", &search_paths);
146158
AppendEnvVarFilename("ARROW_LIBHDFS_DIR", &search_paths);
147159

148160
// All paths with file name

0 commit comments

Comments
 (0)