From 1f190f47cbbca0336d90602f43fd428f3566d0af Mon Sep 17 00:00:00 2001 From: Daniel Hunte Date: Wed, 22 Jan 2025 16:45:57 -0800 Subject: [PATCH] fix(fuzzer): Make PrestoQueryRunner fail when connection to server is unsuccessful (#12135) Summary: Pull Request resolved: https://github.com/facebookincubator/velox/pull/12135 This change throws an exception when the connection to the presto server is unsuccessful. Reviewed By: kagamiori Differential Revision: D68445811 fbshipit-source-id: 1b71f5f6d4eb983d3a04549a46b1579f4745b2eb --- velox/exec/fuzzer/PrestoQueryRunner.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/velox/exec/fuzzer/PrestoQueryRunner.cpp b/velox/exec/fuzzer/PrestoQueryRunner.cpp index 2e9375db2c3c..4fcf9654c54d 100644 --- a/velox/exec/fuzzer/PrestoQueryRunner.cpp +++ b/velox/exec/fuzzer/PrestoQueryRunner.cpp @@ -644,7 +644,11 @@ PrestoQueryRunner::executeAndReturnVector(const core::PlanNodePtr& plan) { // Run the query. return std::make_pair(execute(*sql), ReferenceQueryErrorCode::kSuccess); - } catch (...) { + } catch (const VeloxRuntimeError& e) { + // Throw if connection to Presto server is unsuccessful. + if (e.message().find("Couldn't connect to server") != std::string::npos) { + throw; + } LOG(WARNING) << "Query failed in Presto"; return std::make_pair( std::nullopt, ReferenceQueryErrorCode::kReferenceQueryFail);