Dandandan commented on a change in pull request #8673:
URL: https://github.com/apache/arrow/pull/8673#discussion_r524387603
##########
File path: rust/arrow/benches/aggregate_kernels.rs
##########
@@ -43,6 +43,25 @@ fn create_array(size: usize, with_nulls: bool) -> ArrayRef {
Arc::new(builder.finish())
}
+fn create_string_array(size: usize, with_nulls: bool) -> ArrayRef {
+ // use random numbers to avoid spurious compiler optimizations wrt to
branching
+ let mut rng = seedable_rng();
+ let mut builder = StringBuilder::new(size);
+
+ for _ in 0..size {
+ if with_nulls && rng.gen::<f32>() > 0.5 {
+ builder.append_null().unwrap();
+ } else {
+ let string = seedable_rng()
+ .sample_iter(&Alphanumeric)
+ .take(10)
+ .collect::<String>();
+ builder.append_value(&string).unwrap();
+ }
+ }
+ Arc::new(builder.finish())
+}
Review comment:
Makes sense!
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]