You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/03/25 10:57:37 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1837: [CALCITE-3835] Overloaded table functions fail with an assertion error if param types differ

danny0405 commented on a change in pull request #1837: [CALCITE-3835] Overloaded table functions fail with an assertion error if param types differ
URL: https://github.com/apache/calcite/pull/1837#discussion_r397766734
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/sql/SqlUtil.java
 ##########
 @@ -676,14 +680,16 @@ public static boolean matchRoutinesByParameterCount(
   }
 
   private static RelDataType bestMatch(List<SqlFunction> sqlFunctions, int i,
-      RelDataTypePrecedenceList precList) {
+      List<String> argNames, RelDataTypePrecedenceList precList) {
     RelDataType bestMatch = null;
     for (SqlFunction function : sqlFunctions) {
       List<RelDataType> paramTypes = function.getParamTypes();
       if (paramTypes == null) {
         continue;
       }
-      final RelDataType paramType = paramTypes.get(i);
+      final RelDataType paramType = argNames != null
+          ? paramTypes.get(function.getParamNames().indexOf(argNames.get(i)))
 
 Review comment:
   Does all kinds of functions return a non-empty list if the method call have parameter names ? I don't think so, and how about `function.getParamNames().indexOf(argNames.get(i))` returns `-1` there ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services