From c92a493c4e19886f34367df7807120e535e493ce Mon Sep 17 00:00:00 2001 From: Krishna Pai Date: Thu, 18 Jul 2024 14:03:11 -0700 Subject: [PATCH] Add support for PrestoQueryRunner in AggregationRunnerTest.cpp (#10498) Summary: AggregationRunnerTest serves as a handy tool for replaying, debugging, and validating failures detected by the aggregation fuzzer. However, it currently lacks support for using Presto as the source of truth (SoT), despite the fact that we use Presto as SoT when running the Aggregation Fuzzer. This pull request addresses and resolves this gap. Pull Request resolved: https://github.com/facebookincubator/velox/pull/10498 Reviewed By: kagamiori Differential Revision: D59884675 Pulled By: kgpai fbshipit-source-id: 3be0410876b715446fbd044dcd32b50f50095ead --- velox/exec/tests/AggregationRunnerTest.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/velox/exec/tests/AggregationRunnerTest.cpp b/velox/exec/tests/AggregationRunnerTest.cpp index 2718960907a8..f8b918b9c97d 100644 --- a/velox/exec/tests/AggregationRunnerTest.cpp +++ b/velox/exec/tests/AggregationRunnerTest.cpp @@ -40,6 +40,19 @@ DEFINE_string( "Path for plan nodes to be restored from disk. This will enable single run " "of the fuzzer with the on-disk persisted plan information."); +DEFINE_string( + presto_url, + "", + "Presto coordinator URI along with port. If set, we use Presto " + "source of truth. Otherwise, use DuckDB. Example: " + "--presto_url=http://127.0.0.1:8080"); + +DEFINE_uint32( + req_timeout_ms, + 3000, + "Timeout in milliseconds for HTTP requests made to reference DB, " + "such as Presto. Example: --req_timeout_ms=2000"); + static std::string checkAndReturnFilePath( const std::string_view& fileName, const std::string& flagName) { @@ -76,8 +89,8 @@ int main(int argc, char** argv) { facebook::velox::aggregate::prestosql::registerAllAggregateFunctions(); facebook::velox::functions::prestosql::registerAllScalarFunctions(); - auto duckQueryRunner = - std::make_unique(); + auto queryRunner = facebook::velox::exec::test::setupReferenceQueryRunner( + FLAGS_presto_url, "aggregation_fuzzer", FLAGS_req_timeout_ms); return exec::test::AggregationFuzzerRunner::runRepro( - FLAGS_plan_nodes_path, std::move(duckQueryRunner)); + FLAGS_plan_nodes_path, std::move(queryRunner)); }