Skip to content

Commit

Permalink
fix sanitize(type) in FuzzerUtil for IPPREFIX type
Browse files Browse the repository at this point in the history
  • Loading branch information
kagamiori committed Dec 13, 2024
1 parent d9a6012 commit 37694e1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion velox/exec/fuzzer/FuzzerUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "velox/dwio/catalog/fbhive/FileUtils.h"
#include "velox/dwio/dwrf/writer/Writer.h"
#include "velox/expression/SignatureBinder.h"
#include "velox/functions/prestosql/types/IPPrefixType.h"

using namespace facebook::velox::dwio::catalog::fbhive;

Expand Down Expand Up @@ -283,7 +284,7 @@ bool usesTypeName(
// If 'type' is a RowType or contains RowTypes with empty field names, adds
// default names to these fields in the RowTypes.
TypePtr sanitize(const TypePtr& type) {
if (!type) {
if (!type || isIPPrefixType(type)) {
return type;
}

Expand Down
9 changes: 9 additions & 0 deletions velox/expression/fuzzer/ArgumentTypeFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "velox/exec/fuzzer/FuzzerUtil.h"
#include "velox/expression/ReverseSignatureBinder.h"
#include "velox/expression/SignatureBinder.h"
#include "velox/functions/prestosql/types/IPAddressType.h"
#include "velox/functions/prestosql/types/IPPrefixType.h"
#include "velox/functions/prestosql/types/JsonType.h"
#include "velox/type/Type.h"
#include "velox/vector/fuzzer/VectorFuzzer.h"

Expand All @@ -32,6 +35,12 @@ using exec::test::sanitizeTryResolveType;
std::string typeToBaseName(const TypePtr& type) {
if (type->isDecimal()) {
return "decimal";
} else if (isIPPrefixType(type)) {
return "ipprefix";
} else if (isIPAddressType(type)) {
return "ipaddress";
} else if (isJsonType(type)) {
return "json";
}
return boost::algorithm::to_lower_copy(std::string{type->kindName()});
}
Expand Down
1 change: 1 addition & 0 deletions velox/expression/fuzzer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ target_link_libraries(
velox_type
velox_expression_functions
velox_fuzzer_util
velox_presto_types
GTest::gtest)

add_library(
Expand Down
1 change: 0 additions & 1 deletion velox/expression/fuzzer/ExpressionFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,6 @@ 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 37694e1

Please sign in to comment.