libenchao commented on code in PR #2782:
URL: https://github.com/apache/calcite/pull/2782#discussion_r859890182


##########
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:
   @asolimando I wrote my version like you suggested. However, I found it was 
different from the exception message here: 
https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/runtime/CalciteResource.java#L129
 
   Then I changed it to keep them aligned. WDYT?



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

Reply via email to