apache / arrow-rs

Official Rust implementation of Apache Arrow
https://arrow.apache.org/
Apache License 2.0
2.62k stars 802 forks source link

Support Numeric -> Utf8View casting #6714

Open Omega359 opened 1 week ago

Omega359 commented 1 week ago

Describe the bug

Casting from i32 to utf8View is not currently supported

To Reproduce

#[test]
    fn test_cast_i32_to_utf8view() {
        let array = Int32Array::from(vec![5, 6, 7, 8, 9]);
        let b = cast(&array, &DataType::Utf8View).unwrap();
        let c = b.as_any().downcast_ref::<StringViewArray>().unwrap();
        assert_eq!("5", c.value(0));
        assert_eq!("6", c.value(1));
        assert_eq!("7", c.value(2));
        assert_eq!("8", c.value(3));
        assert_eq!("9", c.value(4));
    }

Expected behavior

Casting from i32 to utf8view arrays is supported.

Additional context

tlm365 commented 1 week ago

take