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

Function isCompanionFunctionName

bolt/functions/CoverageUtil.cpp:292–310  ·  view source on GitHub ↗

A function name is a companion function's if the name is an existing aggregation function name followed by a specific suffixes.

Source from the content-addressed store, hash-verified

290// A function name is a companion function's if the name is an existing
291// aggregation function name followed by a specific suffixes.
292bool isCompanionFunctionName(
293 const std::string& name,
294 const std::unordered_map<std::string, exec::AggregateFunctionEntry>&
295 aggregateFunctions) {
296 auto suffixOffset = name.rfind("_partial");
297 if (suffixOffset == std::string::npos) {
298 suffixOffset = name.rfind("_merge_extract");
299 }
300 if (suffixOffset == std::string::npos) {
301 suffixOffset = name.rfind("_merge");
302 }
303 if (suffixOffset == std::string::npos) {
304 suffixOffset = name.rfind("_extract");
305 }
306 if (suffixOffset == std::string::npos) {
307 return false;
308 }
309 return aggregateFunctions.count(name.substr(0, suffixOffset)) > 0;
310}
311
312/// Returns alphabetically sorted list of scalar functions available in Bolt,
313/// excluding companion functions.

Callers 4

getSortedScalarNamesFunction · 0.85
getSortedAggregateNamesFunction · 0.85
getSortedWindowNamesFunction · 0.85
printCoverageMapFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected