diff --git a/velox/expression/tests/CMakeLists.txt b/velox/expression/tests/CMakeLists.txt index 734a945cf52c..ea61d1820393 100644 --- a/velox/expression/tests/CMakeLists.txt +++ b/velox/expression/tests/CMakeLists.txt @@ -106,6 +106,9 @@ target_link_libraries( velox_fuzzer_util velox_exec_test_lib velox_function_registry + velox_file + velox_hive_connector + velox_fuzzer_util GTest::gtest GTest::gtest_main) diff --git a/velox/expression/tests/ExpressionRunnerTest.cpp b/velox/expression/tests/ExpressionRunnerTest.cpp index 283bd311c8d6..34b2f3be21be 100644 --- a/velox/expression/tests/ExpressionRunnerTest.cpp +++ b/velox/expression/tests/ExpressionRunnerTest.cpp @@ -19,14 +19,19 @@ #include #include #include "velox/common/base/Fs.h" +#include "velox/common/file/FileSystems.h" +#include "velox/connectors/hive/HiveConnector.h" +#include "velox/dwio/dwrf/RegisterDwrfWriter.h" +#include "velox/exec/fuzzer/FuzzerUtil.h" +#include "velox/exec/fuzzer/PrestoQueryRunner.h" #include "velox/exec/fuzzer/ReferenceQueryRunner.h" #include "velox/expression/tests/ExpressionVerifier.h" -#include "velox/functions/prestosql/aggregates/RegisterAggregateFunctions.h" #include "velox/functions/prestosql/registration/RegistrationFunctions.h" #include "velox/functions/sparksql/Register.h" #include "velox/vector/VectorSaver.h" using namespace facebook::velox; +using facebook::velox::exec::test::PrestoQueryRunner; using facebook::velox::test::ReferenceQueryRunner; DEFINE_string( @@ -98,6 +103,19 @@ DEFINE_bool( " were the same between the vectors then the buffers can simply be shared" " between them instead."); +DEFINE_string( + reference_db_url, + "", + "ReferenceDB URI along with port. If set, we use the reference DB as the " + "source of truth. Otherwise, use Velox simplified eval path. Example: " + "--reference_db_url=http://127.0.0.1:8080"); + +DEFINE_uint32( + req_timeout_ms, + 10000, + "Timeout in milliseconds for HTTP requests made to reference DB, " + "such as Presto. Example: --req_timeout_ms=2000"); + static bool validateMode(const char* flagName, const std::string& value) { static const std::unordered_set kModes = { "common", "simplified", "verify", "query"}; @@ -221,7 +239,24 @@ int main(int argc, char** argv) { } memory::initializeMemoryManager({}); + + filesystems::registerLocalFileSystem(); + connector::registerConnectorFactory( + std::make_shared()); + exec::test::registerHiveConnector({}); + dwrf::registerDwrfWriterFactory(); + + std::shared_ptr rootPool{ + facebook::velox::memory::memoryManager()->addRootPool()}; std::shared_ptr referenceQueryRunner{nullptr}; + if (FLAGS_registry == "presto" && !FLAGS_reference_db_url.empty()) { + referenceQueryRunner = std::make_shared( + rootPool.get(), + FLAGS_reference_db_url, + "expression_runner_test", + static_cast(FLAGS_req_timeout_ms)); + LOG(INFO) << "Using Presto as the reference DB."; + } test::ExpressionRunner::run( FLAGS_input_path,