@@ -57,31 +57,6 @@ const std::vector<std::string> getFunctionNameParts(
57
57
return parts;
58
58
}
59
59
60
- // TODO: Remove this function later and retrieve companion function information
61
- // from velox. Approaches for this under discussion here:
62
- // https://github.com/facebookincubator/velox/discussions/11011.
63
- // A function name is a companion function's if the name is an existing
64
- // aggregation function name followed by specific suffixes.
65
- bool isCompanionFunctionName (
66
- const std::string& name,
67
- const std::unordered_map<std::string, exec::AggregateFunctionEntry>&
68
- aggregateFunctions) {
69
- auto suffixOffset = name.rfind (" _partial" );
70
- if (suffixOffset == std::string::npos) {
71
- suffixOffset = name.rfind (" _merge_extract" );
72
- }
73
- if (suffixOffset == std::string::npos) {
74
- suffixOffset = name.rfind (" _merge" );
75
- }
76
- if (suffixOffset == std::string::npos) {
77
- suffixOffset = name.rfind (" _extract" );
78
- }
79
- if (suffixOffset == std::string::npos) {
80
- return false ;
81
- }
82
- return aggregateFunctions.count (name.substr (0 , suffixOffset)) > 0 ;
83
- }
84
-
85
60
const protocol::AggregationFunctionMetadata getAggregationFunctionMetadata (
86
61
const std::string& name,
87
62
const AggregateFunctionSignature& signature) {
@@ -287,7 +262,7 @@ json getFunctionsMetadata() {
287
262
// Skip internal functions. They don't have any prefix.
288
263
if (kBlockList .count (name) != 0 ||
289
264
name.find (" $internal$" ) != std::string::npos ||
290
- isCompanionFunctionName (name, aggregateFunctions) ) {
265
+ getScalarMetadata (name). companionFunction ) {
291
266
continue ;
292
267
}
293
268
@@ -299,7 +274,7 @@ json getFunctionsMetadata() {
299
274
300
275
// Get metadata for all registered aggregate functions in velox.
301
276
for (const auto & entry : aggregateFunctions) {
302
- if (!isCompanionFunctionName (entry.first , aggregateFunctions) ) {
277
+ if (!aggregateFunctions. at (entry.first ). metadata . companionFunction ) {
303
278
const auto name = entry.first ;
304
279
const auto parts = getFunctionNameParts (name);
305
280
const auto schema = parts[1 ];
0 commit comments