vegarsti commented on code in PR #8735:
URL: https://github.com/apache/arrow-rs/pull/8735#discussion_r2609492267


##########
arrow-cast/src/cast/mod.rs:
##########
@@ -11866,4 +11887,327 @@ mod tests {
         // Verify the run-ends were cast correctly (run ends at 3, 6, 9)
         assert_eq!(run_array.run_ends().values(), &[3i64, 6i64, 9i64]);
     }
+
+    #[test]
+    fn test_cast_list_view_to_list() {
+        let list_view = ListViewArray::new(
+            Arc::new(Field::new("a", DataType::Int32, false)),
+            ScalarBuffer::from(vec![0, 3, 6]),
+            ScalarBuffer::from(vec![3, 3, 3]),
+            Arc::new(Int32Array::from(vec![1, 2, 3, 4, 5, 6, 7, 8, 9])),
+            None,
+        );
+        let cast_result = cast(
+            &list_view,
+            &DataType::List(Arc::new(Field::new("a", DataType::Int32, false))),
+        )
+        .unwrap();
+        let got_list = 
cast_result.as_any().downcast_ref::<ListArray>().unwrap();
+
+        let mut offsets = OffsetBufferBuilder::new(0);
+        offsets.push_length(3);
+        offsets.push_length(3);
+        offsets.push_length(3);
+        let expected_list = ListArray::new(
+            Arc::new(Field::new("a", DataType::Int32, false)),
+            offsets.finish(),
+            Arc::new(Int32Array::from(vec![1, 2, 3, 4, 5, 6, 7, 8, 9])),
+            None,
+        );
+        assert_eq!(got_list, &expected_list);

Review Comment:
   > I found it really hard to review the tests without the simplification
   
   sorry! 🫣 
   
   Thank you!!



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to