jayzhan211 commented on code in PR #10193: URL: https://github.com/apache/datafusion/pull/10193#discussion_r1576097589
########## 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: I did this before, and I noticed that `random` is used in test so I need to move it out as an independent function, but adding `name` as another argument looks so weird, so I keep it like this. -- 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