From 3db2cbef7312a95b264bfb0770bdf6a9c5e96649 Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Mon, 15 Apr 2024 10:57:00 +0000 Subject: [PATCH] Cosmetics --- src/Functions/parseDateTime.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Functions/parseDateTime.cpp b/src/Functions/parseDateTime.cpp index 60d540cb5cd7..9670ab48465a 100644 --- a/src/Functions/parseDateTime.cpp +++ b/src/Functions/parseDateTime.cpp @@ -594,9 +594,6 @@ namespace /// Make datetime fit in a cache line. alignas(64) DateTime datetime; - /// Catching and ignoring exceptions after throwing them in the loop below is prohibited can cause serious concurrency performance issues. - /// Use tl::expected to handle the error situation. - /// Usage reference https://en.cppreference.com/w/cpp/utility/expected for (size_t i = 0; i < input_rows_count; ++i) { datetime.reset(); @@ -607,7 +604,11 @@ namespace for (const auto & instruction : instructions) { - if (auto result = instruction.perform(cur, end, datetime); !result.has_value()) + if (auto result = instruction.perform(cur, end, datetime); result.has_value()) + { + cur = *result; + } + else { if constexpr (error_handling == ErrorHandling::Zero) { @@ -625,11 +626,10 @@ namespace else { static_assert(error_handling == ErrorHandling::Exception); - throw Exception(result.error().error_code, "{}", result.error().error_message); + const ErrorCodeAndMessage & err = result.error(); + throw Exception(err.error_code, "{}", err.error_message); } } - else - cur = *result; } if (error)