scovich commented on code in PR #9702:
URL: https://github.com/apache/arrow-rs/pull/9702#discussion_r3074963999


##########
parquet-variant-compute/src/variant_get.rs:
##########
@@ -261,8 +262,24 @@ fn try_perfect_shredding(variant_array: &VariantArray, 
as_field: &Field) -> Opti
         // 2. If every row in the `value` column is null
 
         // This is a perfect shredding, where the value is entirely shredded 
out,
-        // so we can just return the typed value.
-        return Some(typed_value.clone());
+        // so we can just return the typed value after merging the accumulated 
nulls.
+        let parent_nulls = variant_array.nulls();
+
+        // If we have no nulls OR the shredded array is `Null`, which doesn't 
support external nulls.
+        let target_array = if parent_nulls.is_none() || 
typed_value.data_type().is_null() {
+            typed_value.clone()
+        } else {
+            let merged_nulls = NullBuffer::union(parent_nulls, 
typed_value.nulls());
+            let data = typed_value
+                .to_data()
+                .into_builder()
+                .nulls(merged_nulls)
+                .build()
+                .ok()?;
+            make_array(data)
+        };
+
+        return Some(target_array.clone());

Review Comment:
   I don't think we need the clone any more?



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