You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Neville Dipale (Jira)" <ji...@apache.org> on 2019/12/11 17:35:00 UTC

[jira] [Updated] (ARROW-5352) [Rust] BinaryArray filter replaces nulls with empty strings

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

Neville Dipale updated ARROW-5352:
----------------------------------
    Fix Version/s: 1.0.0

> [Rust] BinaryArray filter replaces nulls with empty strings
> -----------------------------------------------------------
>
>                 Key: ARROW-5352
>                 URL: https://issues.apache.org/jira/browse/ARROW-5352
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust
>    Affects Versions: 0.13.0
>            Reporter: Neville Dipale
>            Priority: Minor
>             Fix For: 1.0.0
>
>
> The filter implementation for BinaryArray discards nullness of data. BinaryArrays that are null (seem to) always return an empty string slice when getting a value, so the way filter works might be a bug depending on what Arrow developers' or users' intentions are.
> I think we should either preserve nulls (and their count) or document this as intended behaviour.
> Below is a test case that reproduces the bug.
> {code:java}
> #[test]
> fn test_filter_binary_array_with_nulls() {
> let mut a: BinaryBuilder = BinaryBuilder::new(100);
> a.append_null().unwrap();
> a.append_string("a string").unwrap();
> a.append_null().unwrap();
> a.append_string("with nulls").unwrap();
> let array = a.finish();
> let b = BooleanArray::from(vec![true, true, true, true]);
> let c = filter(&array, &b).unwrap();
> let d: &BinaryArray = c.as_any().downcast_ref::<BinaryArray>().unwrap();
> // I didn't expect this behaviour
> assert_eq!("", d.get_string(0));
> // fails here
> assert!(d.is_null(0));
> assert_eq!(4, d.len());
> // fails here
> assert_eq!(2, d.null_count());
> assert_eq!("a string", d.get_string(1));
> // fails here
> assert!(d.is_null(2));
> assert_eq!("with nulls", d.get_string(3));
> }
> {code}



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