jayzhan211 commented on code in PR #10193:
URL: https://github.com/apache/datafusion/pull/10193#discussion_r1576139980


##########
datafusion/functions/src/math/random.rs:
##########
@@ -69,12 +69,13 @@ impl ScalarUDFImpl for RandomFunc {
     }
 }
 
-/// Random SQL function
 fn random(args: &[ColumnarValue]) -> Result<ColumnarValue> {
-    let len: usize = match &args[0] {
-        ColumnarValue::Array(array) => array.len(),
-        _ => return exec_err!("Expect random function to take no param"),
+    let len = if args.is_empty() {
+        1
+    } else {
+        return exec_err!("Expect random function to take no param");

Review Comment:
   we can even return ScalarValue::F64 instead of Array. Let me fix these too



-- 
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: github-unsubscr...@datafusion.apache.org

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


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

Reply via email to