Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ExpressionRunnerTest to run with PrestoQueryRunner #11254

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions velox/expression/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
37 changes: 36 additions & 1 deletion velox/expression/tests/ExpressionRunnerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@
#include <gflags/gflags.h>
#include <gtest/gtest.h>
#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(
Expand Down Expand Up @@ -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<std::string> kModes = {
"common", "simplified", "verify", "query"};
Expand Down Expand Up @@ -221,7 +239,24 @@ int main(int argc, char** argv) {
}

memory::initializeMemoryManager({});

filesystems::registerLocalFileSystem();
connector::registerConnectorFactory(
std::make_shared<connector::hive::HiveConnectorFactory>());
exec::test::registerHiveConnector({});
dwrf::registerDwrfWriterFactory();

std::shared_ptr<facebook::velox::memory::MemoryPool> rootPool{
facebook::velox::memory::memoryManager()->addRootPool()};
std::shared_ptr<ReferenceQueryRunner> referenceQueryRunner{nullptr};
if (FLAGS_registry == "presto" && !FLAGS_reference_db_url.empty()) {
referenceQueryRunner = std::make_shared<PrestoQueryRunner>(
rootPool.get(),
FLAGS_reference_db_url,
"expression_runner_test",
static_cast<std::chrono::milliseconds>(FLAGS_req_timeout_ms));
LOG(INFO) << "Using Presto as the reference DB.";
}

test::ExpressionRunner::run(
FLAGS_input_path,
Expand Down
Loading