goutamadwant commented on code in PR #24767:
URL: https://github.com/apache/datafusion/pull/24767#discussion_r4002735149


##########
datafusion/common/src/utils/mod.rs:
##########
@@ -603,9 +601,31 @@ impl SingleRowListArrayBuilder {
 
     /// Build a single element [`LargeListArray`]
     pub fn build_large_list_array(self) -> LargeListArray {
+        self.build_generic_list_array()
+    }
+
+    fn build_generic_list_array<OffsetSize: OffsetSizeTrait>(
+        self,
+    ) -> GenericListArray<OffsetSize> {
         let (field, arr) = self.into_field_and_arr();
         let offsets = OffsetBuffer::from_lengths([arr.len()]);
-        LargeListArray::new(field, offsets, arr, None)
+
+        // `is_nullable` is conservative for encoded arrays and can be true
+        // even when the array contains no logical nulls. In that case the
+        // generic constructor rejects a valid non-nullable list child.
+        if !field.is_nullable() && arr.is_nullable() && 
arr.logical_null_count() == 0 {
+            let data = ArrayData::builder(
+                GenericListArray::<OffsetSize>::DATA_TYPE_CONSTRUCTOR(field),
+            )
+            .len(1)
+            .add_buffer(offsets.into_inner().into_inner())
+            .add_child_data(arr.to_data())
+            .build()
+            .expect("single-row list array should contain valid data");
+            return GenericListArray::from(data);

Review Comment:
   Confirmed by executing dictionary scalar compaction; sparse-union compaction 
fails as well. Arrow's list constructors still reject these logically non-null 
encoded children. This remains unresolved, and the follow-up does not widen the 
result type or add another constructor bypass.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to