You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "albel727 (via GitHub)" <gi...@apache.org> on 2023/01/20 23:58:55 UTC

[GitHub] [arrow-rs] albel727 commented on issue #3579: `nullif` incorrectly calculates `null_count`, sometimes panics with substraction overflow error

albel727 commented on issue #3579:
URL: https://github.com/apache/arrow-rs/issues/3579#issuecomment-1399086004

   Just in case, here's the code that I used to validate that the quick fix works:
   ```rust
   
       std::panic::set_hook(Box::new(|_info| { /* silence panics */ }));
   
       for n in 0..=128+64 {
           let left = Int32Array::from((0..n as i32).into_iter().collect::<Vec<_>>());
   
           for somes in 0..=n {
               for trues in 0..=somes {
                   let right = BooleanArray::from((0..n).into_iter().map(|i| {
                       Some(i < trues).filter(|_| i < somes)
                   }).collect::<Vec<_>>());
   
                   let ok = std::panic::catch_unwind(|| {
                       let arr = arrow_select::nullif::nullif(&left, &right).unwrap();
                       let arr: &Int32Array = arrow_array::cast::as_primitive_array(&arr);
                       arrow_array::Array::data(arr).validate_full().unwrap();
                   }).is_ok();
   
                   if !ok {
                       println!("{n} {somes} {trues}");
                   }
               }
           }
       }
   ```


-- 
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-unsubscribe@arrow.apache.org

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