From 88a46b43c431e094ea29a3d741cbc9cf4499c65b Mon Sep 17 00:00:00 2001 From: taiyang-li <654010905@qq.com> Date: Fri, 16 Aug 2024 16:15:15 +0800 Subject: [PATCH] change as request --- .../local-engine/Common/GlutenStringUtils.cpp | 22 +++++++++++++++++++ .../local-engine/Common/GlutenStringUtils.h | 3 +++ .../Storages/SubstraitSource/FormatFile.cpp | 5 +++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cpp-ch/local-engine/Common/GlutenStringUtils.cpp b/cpp-ch/local-engine/Common/GlutenStringUtils.cpp index c699efb1f588..4a18f4ceda02 100644 --- a/cpp-ch/local-engine/Common/GlutenStringUtils.cpp +++ b/cpp-ch/local-engine/Common/GlutenStringUtils.cpp @@ -48,4 +48,26 @@ bool GlutenStringUtils::isNullPartitionValue(const std::string & value) { return value == "__HIVE_DEFAULT_PARTITION__"; } + +std::string GlutenStringUtils::dumpPartitionValue(const PartitionValue & value) +{ + return value.first + "=" + value.second; +} + +std::string GlutenStringUtils::dumpPartitionValues(const PartitionValues & values) +{ + std::string res; + res += "["; + + for (size_t i = 0; i < values.size(); ++i) + { + if (i) + res += ", "; + res += dumpPartitionValue(values[i]); + } + + res += "]"; + return res; +} + } diff --git a/cpp-ch/local-engine/Common/GlutenStringUtils.h b/cpp-ch/local-engine/Common/GlutenStringUtils.h index 023cb2b8d047..dd044135320f 100644 --- a/cpp-ch/local-engine/Common/GlutenStringUtils.h +++ b/cpp-ch/local-engine/Common/GlutenStringUtils.h @@ -28,5 +28,8 @@ class GlutenStringUtils public: static PartitionValues parsePartitionTablePath(const std::string & file); static bool isNullPartitionValue(const std::string & value); + + static std::string dumpPartitionValue(const PartitionValue & value); + static std::string dumpPartitionValues(const PartitionValues & values); }; } diff --git a/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp b/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp index 59ef10a5e047..4499a9a559a1 100644 --- a/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp +++ b/cpp-ch/local-engine/Storages/SubstraitSource/FormatFile.cpp @@ -64,11 +64,12 @@ FormatFile::FormatFile( LOG_INFO( &Poco::Logger::get("FormatFile"), - "Reading File path: {}, format: {}, range: {}, partition_index: {}", + "Reading File path: {}, format: {}, range: {}, partition_index: {}, partition_values: {}", file_info.uri_file(), file_info.file_format_case(), std::to_string(file_info.start()) + "-" + std::to_string(file_info.start() + file_info.length()), - file_info.partition_index()); + file_info.partition_index(), + GlutenStringUtils::dumpPartitionValues(part_vals)); } FormatFilePtr FormatFileUtil::createFile(