From 55a33d97ed9b3ad281c0ce32fdbc086960ed28d9 Mon Sep 17 00:00:00 2001 From: Hongze Zhang Date: Thu, 27 Feb 2025 15:42:57 -0800 Subject: [PATCH] feat: Add JSON SerDe code for member field LocationHandle::targetFileName_ (#12431) Summary: JSON SerDe code for the field LocationHandle::targetFileName_ is missing. The patch adds it. Related to https://github.com/facebookincubator/velox/pull/10903. Pull Request resolved: https://github.com/facebookincubator/velox/pull/12431 Reviewed By: xiaoxmeng Differential Revision: D70260553 Pulled By: kevinwilfong fbshipit-source-id: 9021ec572e693e284db150de08f24cc077e725c5 --- bolt/connectors/hive/HiveDataSink.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bolt/connectors/hive/HiveDataSink.cpp b/bolt/connectors/hive/HiveDataSink.cpp index d77d16837..6ac56639a 100644 --- a/bolt/connectors/hive/HiveDataSink.cpp +++ b/bolt/connectors/hive/HiveDataSink.cpp @@ -938,10 +938,11 @@ std::string HiveInsertTableHandle::toString() const { std::string LocationHandle::toString() const { return fmt::format( - "LocationHandle [targetPath: {}, writePath: {}, tableType: {},", + "LocationHandle [targetPath: {}, writePath: {}, tableType: {}, tableFileName: {}]", targetPath_, writePath_, - tableTypeName(tableType_)); + tableTypeName(tableType_), + targetFileName_); } void LocationHandle::registerSerDe() { @@ -955,6 +956,7 @@ folly::dynamic LocationHandle::serialize() const { obj["targetPath"] = targetPath_; obj["writePath"] = writePath_; obj["tableType"] = tableTypeName(tableType_); + obj["targetFileName"] = targetFileName_; return obj; } @@ -962,7 +964,9 @@ LocationHandlePtr LocationHandle::create(const folly::dynamic& obj) { auto targetPath = obj["targetPath"].asString(); auto writePath = obj["writePath"].asString(); auto tableType = tableTypeFromName(obj["tableType"].asString()); - return std::make_shared(targetPath, writePath, tableType); + auto targetFileName = obj["targetFileName"].asString(); + return std::make_shared( + targetPath, writePath, tableType, targetFileName); } std::unique_ptr HiveDataSink::WriterReclaimer::create(