Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Mar 18, 2024
1 parent 5ecee09 commit ec25e51
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion velox/expression/tests/ArgumentTypeFuzzerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ TEST_F(ArgumentTypeFuzzerTest, decimal) {

testFuzzingDecimalSuccess(signature, BOOLEAN(), 3);

signature = exec::FunctionSignatureBuilder()
signature =
exec::FunctionSignatureBuilder()
.integerVariable("a_precision")
.integerVariable("a_scale")
.integerVariable("b_precision")
Expand Down
10 changes: 7 additions & 3 deletions velox/expression/tests/ExpressionFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,9 +1274,13 @@ core::TypedExprPtr ExpressionFuzzer::generateExpressionFromSignatureTemplate(
}

auto chosenSignature = *chosen->signature;
ArgumentTypeFuzzer fuzzer{chosenSignature, returnType, rng_};
ArgumentTypeFuzzer fuzzer{
chosenSignature, typeName == "DECIMAL" ? nullptr : returnType, rng_};
VELOX_CHECK_EQ(fuzzer.fuzzArgumentTypes(options_.maxNumVarArgs), true);
auto& argumentTypes = fuzzer.argumentTypes();
const TypePtr& outputType =
typeName == "DECIMAL" ? fuzzer.fuzzReturnType() : returnType;

auto constantArguments = chosenSignature.constantArguments();

// ArgumentFuzzer may generate duplicate arguments if the signature's
Expand All @@ -1293,11 +1297,11 @@ core::TypedExprPtr ExpressionFuzzer::generateExpressionFromSignatureTemplate(
.name = chosen->name,
.args = argumentTypes,
.variableArity = false,
.returnType = returnType,
.returnType = outputType,
.constantArgs = constantArguments};

markSelected(chosen->name);
return getCallExprFromCallable(callable, returnType);
return getCallExprFromCallable(callable, outputType);
}

core::TypedExprPtr ExpressionFuzzer::generateCastExpression(
Expand Down

0 comments on commit ec25e51

Please sign in to comment.