tustvold commented on code in PR #5585:
URL: https://github.com/apache/arrow-rs/pull/5585#discussion_r1551385162


##########
arrow-array/src/array/union_array.rs:
##########
@@ -319,6 +319,39 @@ impl UnionArray {
             fields,
         }
     }
+
+    /// Deconstruct this array into its constituent parts
+    ///
+    /// # Example
+    ///
+    /// ```
+    /// # use arrow_array::types::Int32Type;
+    /// # use arrow_array::builder::UnionBuilder;
+    /// # fn main() -> Result<(), arrow_schema::ArrowError> {
+    /// let mut builder = UnionBuilder::new_dense();
+    /// builder.append::<Int32Type>("a", 1).unwrap();
+    /// let union_array = builder.build()?;
+    /// let (data_type, type_ids, offsets, fields) = union_array.into_parts();
+    /// # Ok(())
+    /// # }
+    /// ```
+    #[allow(clippy::type_complexity)]
+    pub fn into_parts(
+        self,
+    ) -> (
+        DataType,
+        ScalarBuffer<i8>,
+        Option<ScalarBuffer<i32>>,
+        Vec<Option<ArrayRef>>,

Review Comment:
   This is exposing what is effectively an implementation detail of UnionArray, 
that it uses a sparse vec to encode type ids. We may want to revisit this in 
future, e.g. to better handle large type ids



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