Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Jun 18, 2024
1 parent 67d5caa commit f64546b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion velox/expression/fuzzer/ExpressionFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -84,7 +85,8 @@ int main(int argc, char** argv) {
{"divide", std::make_shared<DivideArgGenerator>()},
{"floor", std::make_shared<FloorAndRoundArgGenerator>()},
{"round", std::make_shared<FloorAndRoundArgGenerator>()},
{"mod", std::make_shared<ModulusArgGenerator>()}};
{"mod", std::make_shared<ModulusArgGenerator>()},
{"truncate", std::make_shared<TruncateArgGenerator>()}};

return FuzzerRunner::run(initialSeed, skipFunctions, {{}}, argGenerators);
}
36 changes: 36 additions & 0 deletions velox/functions/prestosql/fuzzer/TruncateArgGenerator.h
Original file line number Diff line number Diff line change
@@ -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<std::pair<int, int>> toReturnType(int p, int s) override {
auto rp = std::max(p - s, 1);
auto rs = 0;
return {{rp, rs}};
}
};

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

0 comments on commit f64546b

Please sign in to comment.