@kkhatua 
To avoid this unpleasant parsing I would suggest you add method to 
`FunctionRegistryHolder` which would return `ListMultimap<String, 
DrillFuncHolder>`, where key would be jar_name, value would be list of function 
holders. Let's call it `getAllFunctionsHoldersByJar` (name can be changed).   
Then in `LocalFunctionRegistry` add delegating method:
```
 public ListMultimap<String, DrillFuncHolder> getAllFunctionsHoldersByJar() {
   return registryHolder.getAllFunctionsHoldersByJar();
 }
```
Then in `FunctionImplementationRegistry` add the following method:
```
public ListMultimap<String, DrillFuncHolder> getAllFunctionsHoldersByJar() {
   if (useDynamicUdfs) {
     syncWithRemoteRegistry(localFunctionRegistry.getVersion());
   }
   return localFunctionRegistry.getAllFunctionsHoldersByJar();
 }
```
The above you would get you full list of built-in and remote functions


Code for the `FunctionRegistryHolder` can be the following:
```
  public ListMultimap<String, DrillFuncHolder> getAllFunctionsHoldersByJar() {
    ListMultimap<String, DrillFuncHolder> all = ArrayListMultimap.create();
    for (Map.Entry<String, Map<String, Queue<String>>> entry : jars.entrySet()) 
{
      List<DrillFuncHolder> holders = new ArrayList<>();
      for (String functionName : entry.getValue().keySet()) {
        Collection<DrillFuncHolder> values = 
functions.get(functionName).values();
        holders.addAll(values);
      }
      all.putAll(entry.getKey(), holders);
    }
    return all;
  }
```
Unit test should be added to `FunctionRegistryHolderTest` for the new method.

[ Full content available at: https://github.com/apache/drill/pull/1483 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to