[ 
https://issues.apache.org/jira/browse/ARROW-11051?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ziru Niu updated ARROW-11051:
-----------------------------
    Description: 
Minimal example

 
{quote}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));
 }
  
{quote}
 
{quote}// 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; 

                 }

            });
  
{quote}

  was:
Minimal example

 
{quote}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));
 }
  
{quote}
 
{quote}// 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;              
    }
            });
  
{quote}


> [Rust] Array sum result is wrong with remainder fields
> ------------------------------------------------------
>
>                 Key: ARROW-11051
>                 URL: https://issues.apache.org/jira/browse/ARROW-11051
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust
>    Affects Versions: 2.0.0
>         Environment: Ubuntu 20.04. rustc nightly
>            Reporter: Ziru Niu
>            Priority: Blocker
>
> Minimal example
>  
> {quote}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));
>  }
>   
> {quote}
>  
> {quote}// 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; 
>                  }
>             });
>   
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to