FrankChen021 commented on code in PR #12995:
URL: https://github.com/apache/druid/pull/12995#discussion_r958175376
##########
core/src/main/java/org/apache/druid/math/expr/ApplyFunction.java:
##########
@@ -105,6 +103,44 @@ default boolean hasArrayOutput(LambdaExpr lambdaExpr)
*/
void validateArguments(LambdaExpr lambdaExpr, List<Expr> args);
+ /**
+ * Check that the argument list is the expected size. The list of arguments
should not include the
+ * {@link LambdaExpr} and so the error message will indicate that count + 1
arguments are required.
+ */
+ default void validateArgumentCount(LambdaExpr lambdaExpr, List<Expr> args,
int count)
+ {
+ if (args.size() != count) {
+ throw new ValidationException(this, "needs %s arguments", count + 1);
+ }
+ if (args.size() != lambdaExpr.identifierCount()) {
+ throw new ValidationException(
+ this,
+ "lambda expression argument count of %s does not match count of %s
arguments passed to it ",
Review Comment:
Shouldn't `%s` be `%d`?
--
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]