ritchie46 opened a new issue #334:
URL: https://github.com/apache/arrow-rs/issues/334


   **Describe the bug**
   Casting between:
   
   * list <-> large-list
   * utf8 <-> large-utf8
   
   does not respect offset (and list cast even panics). 
   
   **To Reproduce**
   
   ```rust
       #[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.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to