morrySnow commented on code in PR #54972:
URL: https://github.com/apache/doris/pull/54972#discussion_r2335298997


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Mask.java:
##########
@@ -57,17 +72,12 @@ private Mask(ScalarFunctionParams functionParams) {
      */
     @Override
     public Mask withChildren(List<Expression> children) {
-        Preconditions.checkArgument(!children.isEmpty());
+        Preconditions.checkArgument(!children.isEmpty()
+                && arity() >= 1
+                && arity() <= 4);
         return new Mask(getFunctionParams(children));
     }
 
-    @Override
-    public void checkLegalityAfterRewrite() {
-        if (arity() > 4) {
-            throw new IllegalArgumentException("mask function only supports 1 
to 4 arguments, but got: " + arity());
-        }
-    }
-

Review Comment:
   i think u could move the check to interface 
`org.apache.doris.nereids.trees.expressions.functions.ExpressionTrait#checkLegalityBeforeTypeCoercion`
 to avoid change signature



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

Reply via email to