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

[Rust] Offset is mishandled in arithmetic and boolean compute kernels

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 2.0.0
    • Component/s: Rust

      Description

      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:

       

          #[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));
          }
       

      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.

        Attachments

          Activity

            People

            • Assignee:
              paddyhoran Paddy Horan
              Reporter:
              jhorstmann Jörn Horstmann
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 20m
                2h 20m