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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java:
##########
@@ -58,6 +59,17 @@ public Random(Expression arg) {
         Preconditions.checkState(arg instanceof Literal, "The param of rand 
function must be literal");
     }
 
+    /**
+     * constructor with 1 argument.

Review Comment:
   comment is error



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java:
##########
@@ -80,13 +92,15 @@ public boolean foldable() {
      */
     @Override
     public Random withChildren(List<Expression> children) {
-        Preconditions.checkArgument(children.size() == 0
-                || children.size() == 1);
-        if (children.isEmpty() && arity() == 0) {
-            return this;
-        } else {
+        if (children.isEmpty()) {
+            return new Random();
+        } else if (children.size() == 1) {
             return new Random(children.get(0));
+        } else if (children.size() == 2) {
+            return new Random(children.get(0), children.get(1));
         }
+        Preconditions.checkArgument(false, "random function only accept 0-2 
arguments");

Review Comment:
   throw AnalysisException, do not use check false



-- 
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-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to