Jefffrey commented on code in PR #11288:
URL: https://github.com/apache/arrow-rs/pull/11288#discussion_r4190740402


##########
arrow-data/src/transform/union.rs:
##########
@@ -77,23 +77,27 @@ pub(super) fn extend_nulls_dense(
     let DataType::Union(fields, _) = &mutable.data_type else {
         unreachable!()
     };
-    let first_type_id = fields
+    let null_type_id = fields
         .iter()
-        .next()
-        .expect("union must have at least one field")
+        .find(|(_, field)| field.is_nullable())
+        .expect("cannot extend nulls in a union with no nullable field")

Review Comment:
   can these be errors instead of panics, since the function can already return 
an error



##########
arrow-data/src/transform/union.rs:
##########
@@ -104,16 +108,16 @@ pub(super) fn extend_nulls_sparse(
     let DataType::Union(fields, _) = &mutable.data_type else {
         unreachable!()
     };
-    let first_type_id = fields
+    let null_type_id = fields
         .iter()
-        .next()
-        .expect("union must have at least one field")
+        .find(|(_, field)| field.is_nullable())
+        .expect("cannot extend nulls in a union with no nullable field")

Review Comment:
   same here



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