You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "adelapena (via GitHub)" <gi...@apache.org> on 2023/06/30 12:18:34 UTC

[GitHub] [cassandra] adelapena commented on a diff in pull request #2459: CASSANDRA-18640 trunk: Add vector similarity functions

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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org