Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-11051

[Rust] Array sum result is wrong with remainder fields when simd is on

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.0.0
    • None
    • Rust
    • None
    • Ubuntu 20.04. rustc nightly

    Description

      Minimal example

       

      use arrow::{array::PrimitiveArray, datatypes::Int64Type};

      fn main() {
          let mut s = vec![];
          for _ in 0..32  
           
           {
              s.push(Some(1i64));         s.push(None);     
          }
          let v: PrimitiveArray<Int64Type> = s.into();
          dbg!(arrow::compute::sum(&v));
      }
       

       dependency

      arrow = {version = "2", features = ["simd"]}

      The following code in `compute::sum` is wrong. The bit mask is checked reversed.

                  remainder.iter().enumerate().for_each(|(i, value)| {
                      if remainder_bits & (1 << i) != 0  {

                          remainder_sum = remainder_sum + *value;

                       }

                  });
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            niuzr Ziru Niu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: