From 6863ad347d8455e15817f999400307e80afec6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=87=E5=8D=93=E8=B1=AA?= <5730912+wen_hao_hao@user.noreply.gitee.com> Date: Thu, 14 Sep 2023 03:42:58 +0000 Subject: [PATCH] fix filesystem key error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 文卓豪 <5730912+wen_hao_hao@user.noreply.gitee.com> --- .../cpp/src/tablescan/ParquetReader.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/omnioperator/omniop-spark-extension/cpp/src/tablescan/ParquetReader.cpp b/omnioperator/omniop-spark-extension/cpp/src/tablescan/ParquetReader.cpp index 4f917e22c..626ba257b 100644 --- a/omnioperator/omniop-spark-extension/cpp/src/tablescan/ParquetReader.cpp +++ b/omnioperator/omniop-spark-extension/cpp/src/tablescan/ParquetReader.cpp @@ -38,6 +38,7 @@ static constexpr int32_t INT128_BYTES = 16; static constexpr int32_t INT64_BYTES = 8; static constexpr int32_t BYTE_BITS = 8; static constexpr int32_t LOCAL_FILE_PREFIX = 5; +static constexpr int32_t LOCAL_FILE_PREFIX_EXT = 7; static const std::string LOCAL_FILE = "file:"; static const std::string HDFS_FILE = "hdfs:"; @@ -48,11 +49,9 @@ std::string spark::reader::GetFileSystemKey(std::string& path, std::string& ugi) // if the hdfs file, only get the ip and port just like the ugi + ip + port as key if (path.substr(0, LOCAL_FILE_PREFIX) == HDFS_FILE) { - auto mid = path.find(":", LOCAL_FILE_PREFIX); - auto end = path.find("/", mid); - std::string s1 = path.substr(LOCAL_FILE_PREFIX, mid - LOCAL_FILE_PREFIX); - std::string s2 = path.substr(mid + 1, end - (mid + 1)); - result += s1 + ":" + s2; + auto end = path.find("/", LOCAL_FILE_PREFIX_EXT); + std::string ip_and_port = path.substr(LOCAL_FILE_PREFIX_EXT, end - LOCAL_FILE_PREFIX_EXT); + result += ip_and_port; return result; } -- Gitee