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

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4263: Add constructors for FixedSize array types (#3879)

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


##########
arrow-array/src/array/fixed_size_list_array.rs:
##########
@@ -68,6 +69,114 @@ pub struct FixedSizeListArray {
 }
 
 impl FixedSizeListArray {
+    /// Create a new [`FixedSizeListArray`] with `size` element size, panicking on failure
+    ///
+    /// # Panics
+    ///
+    /// Panics if [`Self::try_new`] returns an error
+    pub fn new(
+        field: FieldRef,
+        size: i32,
+        values: ArrayRef,
+        nulls: Option<NullBuffer>,
+    ) -> Self {
+        Self::try_new(field, size, values, nulls).unwrap()
+    }
+
+    /// Create a new [`FixedSizeListArray`] from the provided parts, returning an error on failure
+    ///
+    /// # Errors
+    ///
+    /// * `size < 0`
+    /// * `values.len() / size != nulls.len()`
+    /// * `values.data_type() != field.data_type()`
+    /// * `!field.is_nullable() && !nulls.expand(size).contains(values.nulls())`
+    pub fn try_new(
+        field: FieldRef,
+        size: i32,

Review Comment:
   Given it is a FixedSizeArray and not a FixedValueLengthArray I'm personally inclined to stick with size, but will sleep on it



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