Dandandan commented on code in PR #14675:
URL: https://github.com/apache/datafusion/pull/14675#discussion_r1957035222


##########
datafusion/functions/src/string/uuid.rs:
##########
@@ -87,7 +88,13 @@ impl ScalarUDFImpl for UuidFunc {
         if !args.is_empty() {
             return internal_err!("{} function does not accept arguments", 
self.name());
         }
-        let values = std::iter::repeat_with(|| 
Uuid::new_v4().to_string()).take(num_rows);
+
+        // Generate random u128 values
+        let mut rng = rand::thread_rng();
+        let mut randoms = vec![0u128; num_rows];
+        rng.fill(&mut randoms[..]);
+
+        let values = randoms.into_iter().map(|x| 
Uuid::from_u128(x).to_string());

Review Comment:
   it would be nice to avoid a `to_string` here as well



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