From a3c49b7f52ad0a58da56d7493511ca145274f007 Mon Sep 17 00:00:00 2001 From: Jia Ke Date: Fri, 20 Dec 2024 23:29:01 +0800 Subject: [PATCH] Only remove the schema for hdfs path. --- .../hive/storage_adapters/hdfs/HdfsFileSystem.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/velox/connectors/hive/storage_adapters/hdfs/HdfsFileSystem.cpp b/velox/connectors/hive/storage_adapters/hdfs/HdfsFileSystem.cpp index 9479279ee54a..b99f34ba4b36 100644 --- a/velox/connectors/hive/storage_adapters/hdfs/HdfsFileSystem.cpp +++ b/velox/connectors/hive/storage_adapters/hdfs/HdfsFileSystem.cpp @@ -91,6 +91,14 @@ std::string HdfsFileSystem::name() const { std::unique_ptr HdfsFileSystem::openFileForRead( std::string_view path, const FileOptions& /*unused*/) { + // Only remove the schema for hdfs path. + if (path.find(kScheme) == 0) { + path.remove_prefix(kScheme.length()); + if (auto index = path.find('/')) { + path.remove_prefix(index); + } + } + return std::make_unique( impl_->hdfsShim(), impl_->hdfsClient(), path); }