vvysotskyi 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_r397800959
 
 

 ##########
 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:
   @danny0405, good question!
   This method is called after calling `filterRoutinesByParameterType()`, which 
will return `false` for the case when the incorrect name was specified in 
`argNames` list: 
https://github.com/apache/calcite/blob/1baee8524a8daa9c67f08f83080e269fc5938bc5/core/src/main/java/org/apache/calcite/sql/SqlUtil.java#L611
   So at this point, we will have a list of functions, that have all parameter 
names from `argNames` list, if it is specified.
   

----------------------------------------------------------------
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