From f64546b9bbb638e9f289320643686f9141df3edb Mon Sep 17 00:00:00 2001 From: rui-mo Date: Tue, 18 Jun 2024 13:41:49 +0800 Subject: [PATCH] Fix --- .github/workflows/experimental.yml | 1 + .../fuzzer/ExpressionFuzzerTest.cpp | 4 ++- .../prestosql/fuzzer/TruncateArgGenerator.h | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 velox/functions/prestosql/fuzzer/TruncateArgGenerator.h diff --git a/.github/workflows/experimental.yml b/.github/workflows/experimental.yml index dfc2b2fbb2fa..4fd88946b700 100644 --- a/.github/workflows/experimental.yml +++ b/.github/workflows/experimental.yml @@ -348,6 +348,7 @@ jobs: --minloglevel=1 \ --repro_persist_path=/tmp/spark_fuzzer_repro \ --velox_fuzzer_enable_decimal_type \ + --retry_with_try \ && echo -e "\n\nSpark Fuzzer run finished successfully." - name: Archive Spark expression production artifacts diff --git a/velox/expression/fuzzer/ExpressionFuzzerTest.cpp b/velox/expression/fuzzer/ExpressionFuzzerTest.cpp index 82e5b22f2bd8..5dc2556465b8 100644 --- a/velox/expression/fuzzer/ExpressionFuzzerTest.cpp +++ b/velox/expression/fuzzer/ExpressionFuzzerTest.cpp @@ -25,6 +25,7 @@ #include "velox/functions/prestosql/fuzzer/ModulusArgGenerator.h" #include "velox/functions/prestosql/fuzzer/MultiplyArgGenerator.h" #include "velox/functions/prestosql/fuzzer/PlusMinusArgGenerator.h" +#include "velox/functions/prestosql/fuzzer/TruncateArgGenerator.h" #include "velox/functions/prestosql/registration/RegistrationFunctions.h" DEFINE_int64( @@ -84,7 +85,8 @@ int main(int argc, char** argv) { {"divide", std::make_shared()}, {"floor", std::make_shared()}, {"round", std::make_shared()}, - {"mod", std::make_shared()}}; + {"mod", std::make_shared()}, + {"truncate", std::make_shared()}}; return FuzzerRunner::run(initialSeed, skipFunctions, {{}}, argGenerators); } diff --git a/velox/functions/prestosql/fuzzer/TruncateArgGenerator.h b/velox/functions/prestosql/fuzzer/TruncateArgGenerator.h new file mode 100644 index 000000000000..b75c94c1b0c7 --- /dev/null +++ b/velox/functions/prestosql/fuzzer/TruncateArgGenerator.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "velox/expression/fuzzer/DecimalArgGeneratorBase.h" + +namespace facebook::velox::exec::test { + +class TruncateArgGenerator : public fuzzer::DecimalArgGeneratorBase { + public: + TruncateArgGenerator() { + initialize(1); + } + + protected: + std::optional> toReturnType(int p, int s) override { + auto rp = std::max(p - s, 1); + auto rs = 0; + return {{rp, rs}}; + } +}; + +} // namespace facebook::velox::exec::test