From bbe7fbd62c56488c6a260917a1d0b19e19a0fffe Mon Sep 17 00:00:00 2001 From: Serge Druzkin Date: Thu, 26 Dec 2024 14:39:56 -0800 Subject: [PATCH] Add malformed partition component to the exception message Summary: Add the malformed partition component to the exception message to facilitate troubleshooting of errors like this https://fburl.com/scuba/xldb_koski_queries/52viv41r Reviewed By: xiaoxmeng Differential Revision: D67652803 --- velox/dwio/catalog/fbhive/FileUtils.cpp | 5 ++++- velox/dwio/catalog/fbhive/test/FileUtilsTests.cpp | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/velox/dwio/catalog/fbhive/FileUtils.cpp b/velox/dwio/catalog/fbhive/FileUtils.cpp index 94c75dffd995..c47231ed172b 100644 --- a/velox/dwio/catalog/fbhive/FileUtils.cpp +++ b/velox/dwio/catalog/fbhive/FileUtils.cpp @@ -151,7 +151,10 @@ std::string FileUtils::unescapePathName(const std::string& data) { std::string tmp{data.data() + i + 1, HEX_WIDTH}; char* end; c = static_cast(std::strtol(tmp.c_str(), &end, 16)); - DWIO_ENSURE(errno != ERANGE && end == tmp.data() + HEX_WIDTH); + DWIO_ENSURE( + errno != ERANGE && end == tmp.data() + HEX_WIDTH, + "Malformed path component: ", + data); i += HEX_WIDTH; } ret.append(1, c); diff --git a/velox/dwio/catalog/fbhive/test/FileUtilsTests.cpp b/velox/dwio/catalog/fbhive/test/FileUtilsTests.cpp index b2909cc0da36..c44400d27b8c 100644 --- a/velox/dwio/catalog/fbhive/test/FileUtilsTests.cpp +++ b/velox/dwio/catalog/fbhive/test/FileUtilsTests.cpp @@ -36,6 +36,9 @@ TEST(FileUtilsTests, MakePartName) { TEST(FileUtilsTests, ParsePartKeyValues) { ASSERT_THROW(FileUtils::parsePartKeyValues("ds"), LoggedException); + ASSERT_THROW( + FileUtils::parsePartKeyValues("ts=2025-01-01+00%3A00%ZZ99"), + LoggedException); ASSERT_THAT( FileUtils::parsePartKeyValues(