A function name is a companion function's if the name is an existing aggregation function name followed by a specific suffixes.
| 290 | // A function name is a companion function's if the name is an existing |
| 291 | // aggregation function name followed by a specific suffixes. |
| 292 | bool 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. |
no test coverage detected