MCPcopy Create free account
hub / github.com/bytedance/bolt / fuzzConstantPrimitiveImpl

Function fuzzConstantPrimitiveImpl

bolt/vector/fuzzer/VectorFuzzer.cpp:641–669  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639
640template <TypeKind kind>
641VectorPtr fuzzConstantPrimitiveImpl(
642 memory::MemoryPool* pool,
643 const TypePtr& type,
644 vector_size_t size,
645 FuzzerGenerator& rng,
646 const VectorFuzzer::Options& opts) {
647 using TCpp = typename TypeTraits<kind>::NativeType;
648 if constexpr (std::is_same_v<TCpp, StringView>) {
649 std::string buf;
650 auto stringView = randString(
651 rng, opts, buf, opts.enableStringIncrementalGeneration, "", 0);
652
653 return std::make_shared<ConstantVector<TCpp>>(
654 pool, size, false, type, std::move(stringView));
655 }
656 if constexpr (std::is_same_v<TCpp, Timestamp>) {
657 return std::make_shared<ConstantVector<TCpp>>(
658 pool, size, false, type, randTimestamp(rng, opts));
659 } else if (type->isShortDecimal()) {
660 return std::make_shared<ConstantVector<int64_t>>(
661 pool, size, false, type, randDecimal<int64_t>(type, rng, true, false));
662 } else if (type->isLongDecimal()) {
663 return std::make_shared<ConstantVector<int128_t>>(
664 pool, size, false, type, randDecimal<int128_t>(type, rng, false, true));
665 } else {
666 return std::make_shared<ConstantVector<TCpp>>(
667 pool, size, false, type, rand<TCpp>(rng));
668 }
669}
670
671template <TypeKind kind>
672void fuzzFlatPrimitiveImpl(

Callers

nothing calls this directly

Calls 4

randStringFunction · 0.85
randTimestampFunction · 0.85
isShortDecimalMethod · 0.80
isLongDecimalMethod · 0.45

Tested by

no test coverage detected