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_r397832408
 
 

 ##########
 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:
   Thanks for the explanation. The code is a mess. Maybe we should have a 
method named filterRoutinesByParameterName

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to