This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 04241919d9 feat: `ArrayData::new_null` for `ListView` / 
`LargeListView` (#8909)
04241919d9 is described below

commit 04241919d9cb791a47ae0276e1768b467d9df545
Author: Khanh Duong <[email protected]>
AuthorDate: Sun Nov 23 23:47:39 2025 +0900

    feat: `ArrayData::new_null` for `ListView` / `LargeListView` (#8909)
    
    # Which issue does this PR close?
    
    - Closes #8908.
    
    # Rationale for this change
    
    Add support for `ListView` and `LargeListView` in `ArrayData::new_null`
    
    # What changes are included in this PR?
    
    Handle match arm + add testcase
    
    # Are these changes tested?
    
    Yes
    
    # Are there any user-facing changes?
    
    No
---
 arrow-data/src/data.rs | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arrow-data/src/data.rs b/arrow-data/src/data.rs
index 91957e14f3..329c12bbf4 100644
--- a/arrow-data/src/data.rs
+++ b/arrow-data/src/data.rs
@@ -615,6 +615,16 @@ impl ArrayData {
                     vec![ArrayData::new_empty(f.data_type())],
                     true,
                 ),
+                DataType::ListView(f) => (
+                    vec![zeroed(len * 4), zeroed(len * 4)],
+                    vec![ArrayData::new_empty(f.data_type())],
+                    true,
+                ),
+                DataType::LargeListView(f) => (
+                    vec![zeroed(len * 8), zeroed(len * 8)],
+                    vec![ArrayData::new_empty(f.data_type())],
+                    true,
+                ),
                 DataType::FixedSizeList(f, list_len) => (
                     vec![],
                     vec![ArrayData::new_null(f.data_type(), *list_len as usize 
* len)],
@@ -2472,5 +2482,23 @@ mod tests {
         for i in 0..array.len() {
             assert!(array.is_null(i));
         }
+
+        let array = ArrayData::new_null(
+            
&DataType::ListView(Arc::new(Field::new_list_field(DataType::Int32, true))),
+            array_len,
+        );
+        assert_eq!(array.len(), array_len);
+        for i in 0..array.len() {
+            assert!(array.is_null(i));
+        }
+
+        let array = ArrayData::new_null(
+            
&DataType::LargeListView(Arc::new(Field::new_list_field(DataType::Int32, 
true))),
+            array_len,
+        );
+        assert_eq!(array.len(), array_len);
+        for i in 0..array.len() {
+            assert!(array.is_null(i));
+        }
     }
 }

Reply via email to