[ 
https://issues.apache.org/jira/browse/TAJO-1997?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15057191#comment-15057191
 ] 

ASF GitHub Bot commented on TAJO-1997:
--------------------------------------

Github user eminency commented on a diff in the pull request:

    https://github.com/apache/tajo/pull/883#discussion_r47589327
  
    --- Diff: 
tajo-core/src/main/java/org/apache/tajo/engine/function/FunctionLoader.java ---
    @@ -299,4 +284,38 @@ private static StaticMethodInvocationDesc 
extractStaticMethodInvocation(Method m
     
         return sqlFuncs;
       }
    +
    +  public static Collection<FunctionDesc> loadFunctions(TajoConf conf) 
throws IOException, AmbiguousFunctionException {
    +    List<FunctionDesc> functionList = new 
ArrayList<>(loadBuiltinFunctions().values());
    +    List<FunctionDesc> udfs = loadUserDefinedFunctions(conf);
    +
    +    return mergeFunctionLists(functionList, udfs);
    +  }
    +
    +  @SafeVarargs
    +  static Collection<FunctionDesc> mergeFunctionLists(List<FunctionDesc> 
... functionLists)
    +      throws AmbiguousFunctionException {
    +
    +    Map<Integer, FunctionDesc> funcMap = new HashMap<>();
    +    List<FunctionDesc> baseFuncList = functionLists[0];
    +
    +    // Build a map with a first list
    +    for (FunctionDesc desc: baseFuncList) {
    +      funcMap.put(desc.hashCodeWithoutType(), desc);
    +    }
    +
    +    // Check duplicates for other function lists(should be UDFs 
practically)
    +    for (int i=1; i<functionLists.length; i++) {
    +      for (FunctionDesc desc: functionLists[i]) {
    +        if (funcMap.containsKey(desc.hashCodeWithoutType())) {
    +          throw new AmbiguousFunctionException(String.format("UDF %s", 
desc.toString()));
    --- End diff --
    
    It is based on the error message template that has existed.
    
    
https://github.com/apache/tajo/blob/ef94bb38d225deaff2d1eeb3d916fbe765412c3a/tajo-common/src/main/java/org/apache/tajo/exception/ErrorMessages.java#L87
    
    So to fix as you advised, some other positions need to be fixed.
    
    If you need, I think you'd better create another issue.


> Registering UDF, it needs to check duplication
> ----------------------------------------------
>
>                 Key: TAJO-1997
>                 URL: https://issues.apache.org/jira/browse/TAJO-1997
>             Project: Tajo
>          Issue Type: Sub-task
>          Components: Function/UDF
>    Affects Versions: 0.11.0
>            Reporter: Jongyoung Park
>            Assignee: Jongyoung Park
>            Priority: Minor
>
> Currently, Tajo doesn't check UDF signature whether it is duplicated with 
> built-in functions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to