You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Jörn Horstmann (Jira)" <ji...@apache.org> on 2020/07/28 13:29:00 UTC

[jira] [Created] (ARROW-9583) Offset is mishandled in arithmetic and boolean compute kernels

Jörn Horstmann created ARROW-9583:
-------------------------------------

             Summary: Offset is mishandled in arithmetic and boolean compute kernels
                 Key: ARROW-9583
                 URL: https://issues.apache.org/jira/browse/ARROW-9583
             Project: Apache Arrow
          Issue Type: Bug
          Components: Rust
    Affects Versions: 1.0.0
            Reporter: Jörn Horstmann


Several compute kernels create the resulting ArrayData with the same offset of one of the operands. Instead this offset should be 0 since the buffer is freshly constructed with the correct len.

Example of one failing test:

 
{code:java}
    #[test]
    fn test_primitive_array_add_sliced() {
        let a = Int32Array::from(vec![0, 0, 0, 5, 6, 7, 8, 9, 0]);
        let b = Int32Array::from(vec![0, 0, 0, 6, 7, 8, 9, 8, 0]);
        let a = a.slice(3, 5);
        let b = b.slice(3, 5);
        let a = a.as_any().downcast_ref::<Int32Array>().unwrap();
        let b = b.as_any().downcast_ref::<Int32Array>().unwrap();

        assert_eq!(5, a.value(0));
        assert_eq!(6, b.value(0));

        let c = add(&a, &b).unwrap();
        assert_eq!(5, c.len());

        assert_eq!(11, c.value(0));
        assert_eq!(13, c.value(1));
        assert_eq!(15, c.value(2));
        assert_eq!(17, c.value(3));
        assert_eq!(17, c.value(4));
    }
 {code}
Additionally, the boolean kernels seem to require that both operands have the same offset. This shouldn't be needed, but it seems that the simd implementation requires that the offset is a multiple of 8 (bits) so that the operation works correctly on whole bytes. The scalar implementation should be fine with any offset.



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