Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast of utf8 types and list container types don't respect offset #334

Closed
ritchie46 opened this issue May 20, 2021 · 2 comments
Closed

Cast of utf8 types and list container types don't respect offset #334

ritchie46 opened this issue May 20, 2021 · 2 comments
Labels
arrow Changes to the arrow crate bug

Comments

@ritchie46
Copy link
Contributor

Describe the bug
Casting between:

  • list <-> large-list
  • utf8 <-> large-utf8

does not respect offset (and list cast even panics).

To Reproduce

    #[test]
    fn test_utf8_cast_offsets() {
        // test if offset of the array is taken into account during cast
        let str_array = StringArray::from(vec!["a", "b", "c"]);
        let str_array = str_array.slice(1, 2);

        let out = cast(&str_array, &DataType::LargeUtf8).unwrap();

        let large_str_array = out.as_any().downcast_ref::<LargeStringArray>().unwrap();
        let strs = large_str_array.into_iter().flatten().collect::<Vec<_>>();
        assert_eq!(strs, &["b", "c"])
    }

    #[test]
    fn test_list_cast_offsets() {
        // test if offset of the array is taken into account during cast
        let array1 = make_list_array().slice(1, 2);
        let array2 = Arc::new(make_list_array()) as ArrayRef;

        let dt = DataType::LargeList(Box::new(Field::new("item", DataType::Int32, true)));
        let out1 = cast(&array1, &dt).unwrap();
        let out2 = cast(&array2, &dt).unwrap();

        assert_eq!(&out1, &out2.slice(1, 2))
    }

Expected behavior
Casting with correct offset.

@ritchie46 ritchie46 added the bug label May 20, 2021
@alamb alamb added the arrow Changes to the arrow crate label May 21, 2021
@ritchie46
Copy link
Contributor Author

This can be closed. Or do we leave this open for the active-release branches?

@nevi-me
Copy link
Contributor

nevi-me commented Jul 11, 2021

Can be closed

@nevi-me nevi-me closed this as completed Jul 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate bug
Projects
None yet
Development

No branches or pull requests

3 participants