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

[Rust][Arrow] Nulls are transformed into "" after filtering for StringArray

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • Rust

    Description

      When I use the filter kernel with Null strings, any input column that was Null turns into an empty string after filtering.

      For example, this test (in filter.rs) should pass:

      
          #[test]
          fn test_filter_string_array_with_null() {
              let a = StringArray::from(vec![Some("hello"), None, Some("world"), None]);
              let b = BooleanArray::from(vec![true, false, false, true]);
              let c = filter(&a, &b).unwrap();
              let d = c.as_ref().as_any().downcast_ref::<StringArray>().unwrap();
              assert_eq!(2, d.len());
              assert_eq!("hello", d.value(0));
              assert_eq!(true, d.is_null(1));
          }
      

      But instead it fails (the second element in the output array should be null )

      ---- compute::kernels::filter::tests::test_filter_string_array_with_null stdout ----
      thread 'compute::kernels::filter::tests::test_filter_string_array_with_null' panicked at 'assertion failed: `(left == right)`
        left: `true`,
       right: `false`', arrow/src/compute/kernels/filter.rs:686:9
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
      

      Attachments

        Issue Links

          Activity

            People

              alamb Andrew Lamb
              alamb Andrew Lamb
              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 - 3h
                  3h