mapleFU commented on code in PR #10326:
URL: https://github.com/apache/arrow-rs/pull/10326#discussion_r3575655992


##########
arrow-data/src/transform/mod.rs:
##########
@@ -117,21 +117,21 @@ fn build_extend_null_bits(array: &ArrayData, use_nulls: 
bool) -> ExtendNullBits<
 /// use arrow_data::ArrayData;
 /// use arrow_data::transform::MutableArrayData;
 /// use arrow_schema::DataType;
-/// fn i32_array(values: &[i32]) -> ArrayData {
-///   ArrayData::try_new(DataType::Int32, 5, None, 0, 
vec![Buffer::from_slice_ref(values)], vec![]).unwrap()
+/// fn i32_array(values: &[i32], len: usize) -> ArrayData {
+///   ArrayData::try_new(DataType::Int32, len, None, 0, 
vec![Buffer::from_slice_ref(values)], vec![]).unwrap()

Review Comment:
   What about get length from `values.len()`?



##########
arrow-data/src/transform/mod.rs:
##########
@@ -397,13 +397,12 @@ impl<'a> MutableArrayData<'a> {
     ///
     /// # Arguments
     /// * `arrays` - the source arrays to copy from
-    /// * `use_nulls` - a flag used to optimize insertions
-    ///   - `false` if the only source of nulls are the arrays themselves
-    ///   - `true` if the user plans to call [MutableArrayData::extend_nulls].
-    /// * capacity - the preallocated capacity of the output array, in bytes
+    /// * `use_nulls` - a flag indicating whether the caller intends to call 
`extend_nulls`.
+    ///   Note: null-handling is enabled automatically if any source array 
contains nulls.
+    /// * `capacity` - the preallocated capacity of the output array, in slots 
(number of elements)
     ///
-    /// Thus, if `use_nulls` is `false`, calling
-    /// [MutableArrayData::extend_nulls] should not be used.
+    /// Thus, if `use_nulls` is `false` and none of the source arrays contain 
nulls,
+    /// calling [MutableArrayData::extend_nulls] should not be used.

Review Comment:
   I found we have `MutableArrayData::extend_nulls` and new 
`MutableArrayData::try_extend_nulls`, should we mention both?



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