bvarghese1 commented on code in PR #23520:
URL: https://github.com/apache/flink/pull/23520#discussion_r1358960432


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/inference/TypeInferenceOperandInference.java:
##########
@@ -62,11 +62,31 @@ public TypeInferenceOperandInference(
         this.typeInference = typeInference;
     }
 
+    private void validateArgumentCount(CallContext callContext) {
+        try {
+            TypeInferenceUtil.validateArgumentCount(
+                    typeInference.getInputTypeStrategy().getArgumentCount(),
+                    callContext.getArgumentDataTypes().size(),
+                    true);
+        } catch (ValidationException e) {
+            final String msg =
+                    String.format(
+                            "%s\nExpected signatures are:\n%s",
+                            e.getMessage(),
+                            TypeInferenceUtil.generateSignature(
+                                    typeInference,
+                                    callContext.getName(),
+                                    callContext.getFunctionDefinition()));
+            throw new ValidationException(msg);
+        }
+    }
+
     @Override
     public void inferOperandTypes(
             SqlCallBinding callBinding, RelDataType returnType, RelDataType[] 
operandTypes) {
         final CallContext callContext =
                 new CallBindingCallContext(dataTypeFactory, definition, 
callBinding, returnType);
+        validateArgumentCount(callContext);
         try {
             inferOperandTypesOrError(unwrapTypeFactory(callBinding), 
callContext, operandTypes);
         } catch (ValidationException | CalciteContextException e) {

Review Comment:
   Applied the suggestion



-- 
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: issues-unsubscr...@flink.apache.org

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

Reply via email to