adelapena commented on code in PR #2459:
URL: https://github.com/apache/cassandra/pull/2459#discussion_r1247799040


##########
src/java/org/apache/cassandra/cql3/functions/FunctionFactory.java:
##########
@@ -101,9 +112,14 @@ public NativeFunction getOrCreateFunction(List<? extends 
AssignmentTestable> arg
                 throw new InvalidRequestException(String.format("Cannot infer 
type of argument %s in call to " +
                                                                 "function %s: 
use type casts to disambiguate",
                                                                 arg, this));
-            parameter.validateType(name, arg, type);
             type = type.udfType();
-            types.add(type);
+            types.set(i, type);
+        }
+
+        // Validate the inferred types of the arguments, again favouring a 
left-to-right reading.
+        for (int i = 0; i < args.size(); i++)
+        {
+            parameters.get(i).validateType(name, args.get(i), types.get(i));

Review Comment:
   Indeed we can drop the reverse iteration and have more consistent error 
messages with some fixes on `FunctionParameter.sameAs`.
   



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to