Skip to content

Commit

Permalink
Remove the use of arg generators for unscaled_value and make_timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Jun 7, 2024
1 parent f5b13c6 commit c0e7627
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
10 changes: 5 additions & 5 deletions velox/expression/fuzzer/ArgumentTypeFuzzer.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ class ArgumentTypeFuzzer {
// successfully bound to a constant value. Return std::nullopt otherwise.
std::optional<int> tryFixedBinding(const std::string& name);

/// Bind the precision and scale variables in a decimal type signature to
/// constant values. Return std::nullopt if the variable cannot be bound to a
/// constant value.
// Bind the precision and scale variables in a decimal type signature to
// constant values. Return std::nullopt if the variable cannot be bound to a
// constant value.
std::pair<std::optional<int>, std::optional<int>> tryBindFixedPrecisionScale(
const exec::TypeSignature& type);

/// Find all the decimal type signatures recursively starting from type then
/// its parameters.
// Find all the decimal type signatures recursively starting from type then
// its parameters.
void findDecimalTypes(
const exec::TypeSignature& type,
std::vector<exec::TypeSignature>& decimalTypes) const;
Expand Down
6 changes: 1 addition & 5 deletions velox/expression/fuzzer/SparkExpressionFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
#include "velox/functions/sparksql/Register.h"
#include "velox/functions/sparksql/fuzzer/AddSubtractArgGenerator.h"
#include "velox/functions/sparksql/fuzzer/DivideArgGenerator.h"
#include "velox/functions/sparksql/fuzzer/MakeTimestampArgGenerator.h"
#include "velox/functions/sparksql/fuzzer/MultiplyArgGenerator.h"
#include "velox/functions/sparksql/fuzzer/UnscaledValueArgGenerator.h"

using namespace facebook::velox::functions::sparksql::fuzzer;
using facebook::velox::fuzzer::ArgGenerator;
Expand Down Expand Up @@ -74,9 +72,7 @@ int main(int argc, char** argv) {
{{"add", std::make_shared<AddSubtractArgGenerator>()},
{"subtract", std::make_shared<AddSubtractArgGenerator>()},
{"multiply", std::make_shared<MultiplyArgGenerator>()},
{"divide", std::make_shared<DivideArgGenerator>()},
{"unscaled_value", std::make_shared<UnscaledValueArgGenerator>()},
{"make_timestamp", std::make_shared<MakeTimestampArgGenerator>()}};
{"divide", std::make_shared<DivideArgGenerator>()}};

return FuzzerRunner::run(
FLAGS_seed, skipFunctions, queryConfigs, argGenerators);
Expand Down
4 changes: 2 additions & 2 deletions velox/expression/fuzzer/tests/ArgumentTypeFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ TEST_F(ArgumentTypeFuzzerTest, fuzzDecimalArgumentTypes) {
EXPECT_EQ(argTypes[0]->toString(), argTypes[2]->toString());
EXPECT_EQ(argTypes[1]->toString(), argTypes[3]->toString());

// Decimal type is nested in complex type.
// Decimal argument types are nested in complex types.
signature = exec::FunctionSignatureBuilder()
.integerVariable("a_scale")
.integerVariable("b_scale")
Expand Down Expand Up @@ -686,7 +686,7 @@ TEST_F(ArgumentTypeFuzzerTest, fuzzDecimalReturnType) {
returnType = fuzzReturnType(*signature);
EXPECT_EQ(DECIMAL(10, 7)->toString(), returnType->toString());

// Decimal type is nested in complex type.
// Decimal return type is nested in complex types.
signature =
exec::FunctionSignatureBuilder()
.integerVariable("a_scale")
Expand Down

0 comments on commit c0e7627

Please sign in to comment.