HaoYang670 commented on code in PR #1964:
URL: https://github.com/apache/arrow-rs/pull/1964#discussion_r909389226


##########
arrow/src/array/array_binary.rs:
##########
@@ -1677,6 +1681,37 @@ mod tests {
         );
     }
 
+    #[test]
+    fn test_decimal_array_from_fixed_size_list() {
+        let value_data = ArrayData::builder(DataType::UInt8)
+            .offset(16)
+            .len(48)
+            .add_buffer(Buffer::from_slice_ref(&[99999_i128, 12, 34, 56]))
+            .build()
+            .unwrap();
+
+        let null_buffer = Buffer::from_slice_ref(&[0b101]);
+
+        // Construct a list array from the above two
+        let list_data_type = DataType::FixedSizeList(
+            Box::new(Field::new("item", DataType::UInt8, false)),
+            16,
+        );
+        let list_data = ArrayData::builder(list_data_type)
+            .len(2)
+            .null_bit_buffer(Some(null_buffer))
+            .offset(1)
+            .add_child_data(value_data)
+            .build()
+            .unwrap();
+        let list_array = FixedSizeListArray::from(list_data);
+        let decimal = DecimalArray::from_fixed_size_list_array(list_array, 38, 
0);
+
+        assert_eq!(decimal.len(), 2);
+        assert!(decimal.is_null(0));
+        assert_eq!(decimal.value_as_string(1), "56".to_string());

Review Comment:
   I think this is the expected result, because slicing a list array doesn't 
push down the offset to child



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to