alamb commented on code in PR #9087:
URL: https://github.com/apache/arrow-rs/pull/9087#discussion_r2657766028
##########
arrow-select/src/nullif.rs:
##########
@@ -494,38 +493,115 @@ mod tests {
let r_data = r.to_data();
r_data.validate().unwrap();
- assert_eq!(r.as_ref(), &expected);
+ assert_eq!(
+ r.as_ref(),
+ &expected,
+ "expected nulls: {:#?}\n\n\
+ result nulls: {:#?}\n\n\\
+ expected values: {:#?}\n\n\
+ result values: {:#?}",
+ expected.nulls(),
+ r.nulls(),
+ expected.values(),
+ r.as_primitive::<Int32Type>().values()
+ );
+ validate_nulls(expected.nulls());
+ validate_nulls(r.nulls());
+ }
+
+ /// Ensures that the null count matches the actual number of nulls.
+ fn validate_nulls(nulls: Option<&NullBuffer>) {
+ let Some(nulls) = nulls else {
+ return;
+ };
+ let mut actual_null_count = 0;
+ for i in 0..nulls.len() {
+ if nulls.is_null(i) {
+ actual_null_count += 1;
+ }
+ }
+ assert_eq!(actual_null_count, nulls.null_count());
}
#[test]
fn nullif_fuzz() {
- let mut rng = rng();
+ let mut rng = StdRng::seed_from_u64(7337);
Review Comment:
use fixed random seed so the test is reproducable
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]