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


##########
arrow-array/src/builder/boolean_builder.rs:
##########
@@ -167,6 +167,7 @@ impl BooleanBuilder {
             .add_buffer(self.values_builder.finish().into_inner())
             .nulls(null_bit_buffer);
 
+        // SAFETY: builder is constructed from valid boolean bitmap and null 
buffer with matching lengths

Review Comment:
   something to note is if we use the array unchecked constructors, its easier 
to see what invariants we actually need to uphold. in this case i think all 
that matters is ensuring lengths match, so no need to mention "valid boolean 
bitmap"



##########
arrow-array/src/builder/fixed_size_binary_builder.rs:
##########
@@ -135,6 +135,7 @@ impl FixedSizeBinaryBuilder {
             .add_buffer(std::mem::take(&mut self.values_builder).into())
             .nulls(self.null_buffer_builder.finish())
             .len(array_length);
+        // SAFETY: builder is constructed from fixed-size binary values and 
null buffer with lengths guaranteed by the builder
         let array_data = unsafe { array_data_builder.build_unchecked() };
         FixedSizeBinaryArray::from(array_data)

Review Comment:
   same here, we can list these invariants are satisfied for example
   
   
https://github.com/apache/arrow-rs/blob/c62002b036a0b0c6fd78053c03735f68aedf8ca4/arrow-array/src/array/fixed_size_binary_array.rs#L121-L128



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