You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/03/30 16:15:54 UTC

[GitHub] [arrow-rs] alamb commented on a diff in pull request #3953: Don't discard nulls converting StructArray to RecordBatch (#3951)

alamb commented on code in PR #3953:
URL: https://github.com/apache/arrow-rs/pull/3953#discussion_r1153489207


##########
arrow-array/src/array/struct_array.rs:
##########
@@ -89,6 +89,14 @@ impl StructArray {
         }
     }
 
+    /// Returns the [`Field`] of this [`StructArray`]
+    pub fn fields(&self) -> &[Field] {

Review Comment:
   I wonder if this needs to be updated to avoid a logical conflict with `FieldList`



##########
arrow-array/src/record_batch.rs:
##########
@@ -447,23 +447,28 @@ impl Default for RecordBatchOptions {
         Self::new()
     }
 }
+impl From<StructArray> for RecordBatch {
+    fn from(value: StructArray) -> Self {
+        assert_eq!(
+            value.null_count(),
+            0,
+            "Cannot convert nullable StructArray to RecordBatch"

Review Comment:
   I don't understand why this is an error
   
   Wouldn't it make more sense to apply  the parent `StructArray` validity mask to each child's mask to form a new mask that is only non null if both the struct array and the child array were non null 🤔 



-- 
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-unsubscribe@arrow.apache.org

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