Skip to content

Commit

Permalink
Add ipprefix to the fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsaka committed Dec 6, 2024
1 parent 7672dd5 commit 817f32e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions velox/expression/fuzzer/ExpressionFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ void addCastFromDateSignature(
signatures.push_back(makeCastSignature("date", toType));
}

void addCastFromIPPrefixSignature(
const std::string& toType,
std::vector<facebook::velox::exec::FunctionSignaturePtr>& signatures) {
signatures.push_back(makeCastSignature("ipprefix", toType));
}

std::vector<facebook::velox::exec::FunctionSignaturePtr>
getSignaturesForCast() {
std::vector<facebook::velox::exec::FunctionSignaturePtr> signatures;
Expand All @@ -149,6 +155,7 @@ getSignaturesForCast() {
addCastFromVarcharSignature("varchar", signatures);
addCastFromDateSignature("varchar", signatures);
addCastFromTimestampSignature("varchar", signatures);
addCastFromIPPrefixSignature("varchar", signatures);

// To timestamp type.
addCastFromVarcharSignature("timestamp", signatures);
Expand All @@ -158,6 +165,9 @@ getSignaturesForCast() {
addCastFromVarcharSignature("date", signatures);
addCastFromTimestampSignature("date", signatures);

// To ipprefix type.
addCastFromVarcharSignature("ipprefix", signatures);

// For each supported translation pair T --> U, add signatures of array(T) -->
// array(U), map(varchar, T) --> map(varchar, U), row(T) --> row(U).
auto size = signatures.size();
Expand Down Expand Up @@ -664,6 +674,7 @@ bool ExpressionFuzzer::isSupportedSignature(
if (usesTypeName(signature, "opaque") ||
usesTypeName(signature, "timestamp with time zone") ||
usesTypeName(signature, "interval day to second") ||
usesTypeName(signature, "ipprefix") ||
(!options_.enableDecimalType && usesTypeName(signature, "decimal")) ||
(!options_.enableComplexTypes && useComplexType) ||
(options_.enableComplexTypes && usesTypeName(signature, "unknown"))) {
Expand Down

0 comments on commit 817f32e

Please sign in to comment.