From bc6a7db3b4d1c1b934e3f41eb37698293d78202f Mon Sep 17 00:00:00 2001 From: Daniel Hunte Date: Mon, 18 Nov 2024 15:18:42 -0800 Subject: [PATCH] fix(fuzzer): Fix toSql methods for NestedLoopJoinNode in Reference Query Runners (#11576) Summary: The select clause is completely missing in the produced query string. Differential Revision: D66132514 --- velox/exec/fuzzer/DuckQueryRunner.cpp | 13 ++----------- velox/exec/fuzzer/PrestoQueryRunner.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/velox/exec/fuzzer/DuckQueryRunner.cpp b/velox/exec/fuzzer/DuckQueryRunner.cpp index 7943d68f84acd..ee9f9ed163e84 100644 --- a/velox/exec/fuzzer/DuckQueryRunner.cpp +++ b/velox/exec/fuzzer/DuckQueryRunner.cpp @@ -428,20 +428,11 @@ std::optional DuckQueryRunner::toSql( std::optional DuckQueryRunner::toSql( const std::shared_ptr& joinNode) { - const auto& joinKeysToSql = [](auto keys) { - std::stringstream out; - for (auto i = 0; i < keys.size(); ++i) { - if (i > 0) { - out << ", "; - } - out << keys[i]->name(); - } - return out.str(); - }; - const auto& outputNames = joinNode->outputType()->names(); std::stringstream sql; + sql << "SELECT " << folly::join(", ", outputNames); + // Nested loop join without filter. VELOX_CHECK( joinNode->joinCondition() == nullptr, diff --git a/velox/exec/fuzzer/PrestoQueryRunner.cpp b/velox/exec/fuzzer/PrestoQueryRunner.cpp index 605841d48a161..d0dede8cbeb1c 100644 --- a/velox/exec/fuzzer/PrestoQueryRunner.cpp +++ b/velox/exec/fuzzer/PrestoQueryRunner.cpp @@ -643,20 +643,11 @@ std::optional PrestoQueryRunner::toSql( std::optional PrestoQueryRunner::toSql( const std::shared_ptr& joinNode) { - const auto& joinKeysToSql = [](auto keys) { - std::stringstream out; - for (auto i = 0; i < keys.size(); ++i) { - if (i > 0) { - out << ", "; - } - out << keys[i]->name(); - } - return out.str(); - }; - const auto& outputNames = joinNode->outputType()->names(); std::stringstream sql; + sql << "SELECT " << folly::join(", ", outputNames); + // Nested loop join without filter. VELOX_CHECK( joinNode->joinCondition() == nullptr,