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

Method addSignature

bolt/exec/fuzzer/AggregationFuzzerBase.cpp:143–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141 for (auto& signature : signatures) {
142 hasSupportedSignature |= addSignature(name, signature);
143 }
144 if (hasSupportedSignature) {
145 ++functionsStats.numSupportedFunctions;
146 }
147 }
148}
149
150std::pair<CallableSignature, AggregationFuzzerBase::SignatureStats&>
151AggregationFuzzerBase::pickSignature() {
152 size_t idx = boost::random::uniform_int_distribution<uint32_t>(
153 0, signatures_.size() + signatureTemplates_.size() - 1)(rng_);
154 CallableSignature signature;
155 if (idx < signatures_.size()) {
156 signature = signatures_[idx];
157 } else {
158 const auto& signatureTemplate =
159 signatureTemplates_[idx - signatures_.size()];
160 signature.name = signatureTemplate.name;
161 bolt::fuzzer::ArgumentTypeFuzzer typeFuzzer(
162 *signatureTemplate.signature, rng_);
163 BOLT_CHECK(typeFuzzer.fuzzArgumentTypes(FLAGS_bolt_fuzzer_max_num_varargs));
164 signature.args = typeFuzzer.argumentTypes();
165 }
166
167 return {signature, signatureStats_[idx]};
168}
169
170std::vector<std::string> AggregationFuzzerBase::generateKeys(
171 const std::string& prefix,
172 std::vector<std::string>& names,
173 std::vector<TypePtr>& types) {
174 static const std::vector<TypePtr> kNonFloatingPointTypes{
175 BOOLEAN(),
176 TINYINT(),
177 SMALLINT(),
178 INTEGER(),
179 BIGINT(),
180 VARCHAR(),
181 VARBINARY(),
182 TIMESTAMP(),
183 };
184
185 auto numKeys = boost::random::uniform_int_distribution<uint32_t>(1, 5)(rng_);
186 std::vector<std::string> keys;
187 for (auto i = 0; i < numKeys; ++i) {
188 keys.push_back(fmt::format("{}{}", prefix, i));
189
190 // Pick random, possibly complex, type.
191 types.push_back(vectorFuzzer_.randType(kNonFloatingPointTypes, 2));
192 names.push_back(keys.back());
193 }
194 return keys;
195}
196
197std::vector<std::string> AggregationFuzzerBase::generateSortingKeys(
198 const std::string& prefix,
199 std::vector<std::string>& names,
200 std::vector<TypePtr>& types) {

Callers

nothing calls this directly

Calls 11

tryResolveTypeFunction · 0.85
ROWFunction · 0.85
variableArityMethod · 0.80
isIntegerParameterMethod · 0.80
toStringMethod · 0.45
emptyMethod · 0.45
insertMethod · 0.45
push_backMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
childrenMethod · 0.45

Tested by

no test coverage detected