@@ -265,7 +265,7 @@ json buildWindowMetadata(
265265
266266} // namespace
267267
268- json getFunctionsMetadata () {
268+ json getFunctionsMetadata (const std::optional<std::string>& catalog ) {
269269 json j;
270270
271271 // Get metadata for all registered scalar functions in velox.
@@ -285,60 +285,8 @@ json getFunctionsMetadata() {
285285 }
286286
287287 const auto parts = getFunctionNameParts (name);
288- const auto schema = parts[1 ];
289- const auto function = parts[2 ];
290- j[function] = buildScalarMetadata (name, schema, entry.second );
291- }
292-
293- // Get metadata for all registered aggregate functions in velox.
294- for (const auto & entry : aggregateFunctions) {
295- if (!aggregateFunctions.at (entry.first ).metadata .companionFunction ) {
296- const auto name = entry.first ;
297- const auto parts = getFunctionNameParts (name);
298- const auto schema = parts[1 ];
299- const auto function = parts[2 ];
300- j[function] =
301- buildAggregateMetadata (name, schema, entry.second .signatures );
302- }
303- }
304-
305- // Get metadata for all registered window functions in velox. Skip aggregates
306- // as they have been processed.
307- const auto & functions = exec::windowFunctions ();
308- for (const auto & entry : functions) {
309- if (aggregateFunctions.count (entry.first ) == 0 ) {
310- const auto name = entry.first ;
311- const auto parts = getFunctionNameParts (entry.first );
312- const auto schema = parts[1 ];
313- const auto function = parts[2 ];
314- j[function] = buildWindowMetadata (name, schema, entry.second .signatures );
315- }
316- }
317-
318- return j;
319- }
320-
321- json getFunctionsMetadata (const std::string& catalog) {
322- json j;
323-
324- // Get metadata for all registered scalar functions in velox.
325- const auto signatures = getFunctionSignatures ();
326- static const std::unordered_set<std::string> kBlockList = {
327- " row_constructor" , " in" , " is_null" };
328- // Exclude aggregate companion functions (extract aggregate companion
329- // functions are registered as vector functions).
330- const auto aggregateFunctions = exec::aggregateFunctions ().copy ();
331- for (const auto & entry : signatures) {
332- const auto name = entry.first ;
333- // Skip internal functions. They don't have any prefix.
334- if (kBlockList .count (name) != 0 ||
335- name.find (" $internal$" ) != std::string::npos ||
336- getScalarMetadata (name).companionFunction ) {
337- continue ;
338- }
339-
340- const auto parts = getFunctionNameParts (name);
341- if (parts[0 ] != catalog) {
288+ // Skip if catalog filter is specified and doesn't match
289+ if (catalog.has_value () && parts[0 ] != catalog.value ()) {
342290 continue ;
343291 }
344292 const auto schema = parts[1 ];
@@ -351,7 +299,8 @@ json getFunctionsMetadata(const std::string& catalog) {
351299 if (!aggregateFunctions.at (entry.first ).metadata .companionFunction ) {
352300 const auto name = entry.first ;
353301 const auto parts = getFunctionNameParts (name);
354- if (parts[0 ] != catalog) {
302+ // Skip if catalog filter is specified and doesn't match
303+ if (catalog.has_value () && parts[0 ] != catalog.value ()) {
355304 continue ;
356305 }
357306 const auto schema = parts[1 ];
@@ -368,7 +317,8 @@ json getFunctionsMetadata(const std::string& catalog) {
368317 if (aggregateFunctions.count (entry.first ) == 0 ) {
369318 const auto name = entry.first ;
370319 const auto parts = getFunctionNameParts (entry.first );
371- if (parts[0 ] != catalog) {
320+ // Skip if catalog filter is specified and doesn't match
321+ if (catalog.has_value () && parts[0 ] != catalog.value ()) {
372322 continue ;
373323 }
374324 const auto schema = parts[1 ];
0 commit comments