Skip to content

Commit

Permalink
Add support for aggregation fuzzer to call Presto java and setup CI r…
Browse files Browse the repository at this point in the history
…un. (#7947)

Summary:
This PR:
1. Sets up Aggregation Fuzzer to call Presto Java
2. Sets up an experimental scheduled run for the agg fuzzer.

Pull Request resolved: #7947

Reviewed By: mbasmanova

Differential Revision: D52040998

Pulled By: kgpai

fbshipit-source-id: 020282eef5f2c950c000cebed388fb160aba726b
  • Loading branch information
kgpai authored and facebook-github-bot committed Jan 9, 2024
1 parent 005e545 commit fd920aa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
name: aggregation

- name: "Run Aggregate Fuzzer"
run: |
run: |
mkdir -p /tmp/aggregate_fuzzer_repro/
rm -rfv /tmp/aggregate_fuzzer_repro/*
chmod -R 777 /tmp/aggregate_fuzzer_repro
Expand Down Expand Up @@ -177,4 +177,3 @@ jobs:
name: spark-agg-fuzzer-failure-artifacts
path: |
/tmp/spark_aggregate_fuzzer_repro
38 changes: 27 additions & 11 deletions velox/functions/prestosql/fuzzer/AggregationFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "velox/exec/fuzzer/AggregationFuzzerOptions.h"
#include "velox/exec/fuzzer/AggregationFuzzerRunner.h"
#include "velox/exec/fuzzer/DuckQueryRunner.h"
#include "velox/exec/fuzzer/PrestoQueryRunner.h"
#include "velox/exec/fuzzer/TransformResultVerifier.h"
#include "velox/functions/prestosql/aggregates/RegisterAggregateFunctions.h"
#include "velox/functions/prestosql/fuzzer/ApproxDistinctInputGenerator.h"
Expand All @@ -45,6 +46,13 @@ DEFINE_string(
"this comma separated list of function names "
"(e.g: --only \"min\" or --only \"sum,avg\").");

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");

namespace facebook::velox::exec::test {
namespace {

Expand All @@ -61,6 +69,23 @@ getCustomInputGenerators() {
};
}

std::unique_ptr<ReferenceQueryRunner> setupReferenceQueryRunner() {
if (FLAGS_presto_url.empty()) {
auto duckQueryRunner = std::make_unique<DuckQueryRunner>();
duckQueryRunner->disableAggregateFunctions({
"skewness",
// DuckDB results on constant inputs are incorrect. Should be NaN,
// but DuckDB returns some random value.
"kurtosis",
"entropy",
});
return duckQueryRunner;
} else {
return std::make_unique<PrestoQueryRunner>(
FLAGS_presto_url, "aggregation_fuzzer");
}
}

} // namespace
} // namespace facebook::velox::exec::test

Expand All @@ -81,16 +106,6 @@ int main(int argc, char** argv) {

size_t initialSeed = FLAGS_seed == 0 ? std::time(nullptr) : FLAGS_seed;

auto duckQueryRunner =
std::make_unique<facebook::velox::exec::test::DuckQueryRunner>();
duckQueryRunner->disableAggregateFunctions({
"skewness",
// DuckDB results on constant inputs are incorrect. Should be NaN,
// but DuckDB returns some random value.
"kurtosis",
"entropy",
});

// List of functions that have known bugs that cause crashes or failures.
static const std::unordered_set<std::string> skipFunctions = {
// https://github.com/facebookincubator/velox/issues/3493
Expand All @@ -101,6 +116,7 @@ int main(int argc, char** argv) {

using facebook::velox::exec::test::ApproxDistinctResultVerifier;
using facebook::velox::exec::test::ApproxPercentileResultVerifier;
using facebook::velox::exec::test::setupReferenceQueryRunner;
using facebook::velox::exec::test::TransformResultVerifier;

auto makeArrayVerifier = []() {
Expand Down Expand Up @@ -161,5 +177,5 @@ int main(int argc, char** argv) {
facebook::velox::exec::test::getCustomInputGenerators();
options.timestampPrecision =
facebook::velox::VectorFuzzer::Options::TimestampPrecision::kMilliSeconds;
return Runner::run(initialSeed, std::move(duckQueryRunner), options);
return Runner::run(initialSeed, setupReferenceQueryRunner(), options);
}

0 comments on commit fd920aa

Please sign in to comment.