You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2022/04/27 14:31:55 UTC
[GitHub] [calcite] asolimando commented on a diff in pull request #2782: [CALCITE-5118] SqlDatePartFunction#rewriteCall should check operands length
asolimando commented on code in PR #2782:
URL: https://github.com/apache/calcite/pull/2782#discussion_r859875686
##########
core/src/main/java/org/apache/calcite/sql/fun/SqlDatePartFunction.java:
##########
@@ -56,6 +58,11 @@ public SqlDatePartFunction(String name, TimeUnit timeUnit) {
@Override public SqlNode rewriteCall(SqlValidator validator, SqlCall call) {
final List<SqlNode> operands = call.getOperandList();
+
+ Preconditions.checkArgument(operands.size() == 1,
+ String.format("Invalid number of arguments to function '%s'."
+ + " Was expecting 1 arguments", getName()));
Review Comment:
Nitpick suggestion:
```suggestion
Preconditions.checkArgument(operands.size() == 1,
String.format("Invalid number of arguments for function '%s'."
+ " Was expecting 1 argument, found %d", getName(), operands.size()));
```
If you agree, then please update also the test results accordingly.
--
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: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org