-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add opaque type support to vector fuzzer #11189
Conversation
This pull request was exported from Phabricator. Differential Revision: D63998462 |
✅ Deploy Preview for meta-velox canceled.
|
bbf0d30
to
36dc40b
Compare
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
This pull request was exported from Phabricator. Differential Revision: D63998462 |
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
36dc40b
to
ea06dbd
Compare
This pull request was exported from Phabricator. Differential Revision: D63998462 |
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
ea06dbd
to
64e574f
Compare
This pull request was exported from Phabricator. Differential Revision: D63998462 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just a few small comments
VectorPtr VectorFuzzer::fuzzFlatOpaque( | ||
const TypePtr& type, | ||
vector_size_t size) { | ||
auto vector = BaseVector::create(type, size, pool_); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a VELOX_CHECK to ensure the type is indeed opaque
velox/vector/fuzzer/VectorFuzzer.cpp
Outdated
|
||
auto& opaqueType = type->asOpaque(); | ||
auto flatVector = vector->as<TFlat>(); | ||
auto& opaqueTypeGenerator = opaqueTypeGenerators_[opaqueType.typeIndex()]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we check first if a generator exists and return an error if it doesnt?
velox/vector/fuzzer/VectorFuzzer.cpp
Outdated
for (size_t i = 0; i < vector->size(); ++i) { | ||
flatVector->set(i, opaqueTypeGenerator(rng_)); | ||
} | ||
|
||
for (size_t i = 0; i < vector->size(); ++i) { | ||
if (coinToss(opts_.nullRatio)) { | ||
flatVector->setNull(i, true); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we merge these and skip generation if a row is set to null?
@@ -374,6 +386,11 @@ class VectorFuzzer { | |||
// function. C++ does not guarantee the order in which arguments are | |||
// evaluated, which can lead to inconsistent results across platforms. | |||
FuzzerGenerator rng_; | |||
|
|||
std::unordered_map< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you add a comment about what it contains and how its populated?
private: | ||
// Generates a flat vector for primitive types. | ||
VectorPtr fuzzFlatPrimitive(const TypePtr& type, vector_size_t size); | ||
|
||
// Generates a flat vector for opaque types. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: after you add the checks I mentioned earlier, can you also update the comment to mention that it can throw for those cases
64e574f
to
3269e83
Compare
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
This pull request was exported from Phabricator. Differential Revision: D63998462 |
VectorFuzzer::Options opts; | ||
opts.nullRatio = 0.5; | ||
VectorFuzzer fuzzer(opts, pool()); | ||
fuzzer.registerOpaqueTypeGenerator<Foo>([](FuzzerGenerator& rng) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you register two OpaqueTypeGenerators for Foo and Bar to ensure the correct one can be retrieved?
VectorFuzzer::Options opts; | ||
opts.nullRatio = 0.5; | ||
VectorFuzzer fuzzer(opts, pool()); | ||
fuzzer.registerOpaqueTypeGenerator<Foo>([](FuzzerGenerator& rng) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
3269e83
to
f80ffcb
Compare
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
This pull request was exported from Phabricator. Differential Revision: D63998462 |
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Differential Revision: D63998462
f80ffcb
to
03a0cfe
Compare
This pull request was exported from Phabricator. Differential Revision: D63998462 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except one comment. Thank you for extending VectorFuzzer with the support of opaque types!
ASSERT_TRUE( | ||
vector->encoding() == VectorEncoding::Simple::DICTIONARY || | ||
vector->encoding() == VectorEncoding::Simple::FLAT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a chance of fuzzer.fuzz() generating a constant vector too.
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Reviewed By: kagamiori Differential Revision: D63998462
03a0cfe
to
0e2d1a2
Compare
This pull request was exported from Phabricator. Differential Revision: D63998462 |
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Reviewed By: kagamiori Differential Revision: D63998462
Summary: In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Reviewed By: kagamiori Differential Revision: D63998462
This pull request has been merged in 48f6b8d. |
Conbench analyzed the 1 benchmark run on commit There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Summary: Pull Request resolved: facebookincubator#11189 In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them. The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so. Reviewed By: kagamiori Differential Revision: D63998462 fbshipit-source-id: c3f18ae6d660cf105f7b13a9fce842f8ceeec0c8
Summary:
In preparation for supporting Opaque types in Presto page serialization, I'd like to add support to fuzz testing to them.
The idea is that each custom type will have to provide its own randomizing function, since it's otherwise impossible for the framework to do so.
Differential Revision: D63998462