You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Rich-T-kid (via GitHub)" <gi...@apache.org> on 2026/08/25 20:32:10 UTC

[PR] docs : add saftey comments [arrow-rs]

Rich-T-kid opened a new pull request, #10843:
URL: https://github.com/apache/arrow-rs/pull/10843

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax.
   -->
   
   - Closes #146
   .
   
   # Rationale for this change
   see https://github.com/apache/arrow-rs/issues/146#issuecomment-5415976683
   <!--
   Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
   Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
   -->
   
   # What changes are included in this PR?
   updates the remaining call sites in https://github.com/apache/arrow-rs/issues/146#issuecomment-5415976683
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   # Are these changes tested?
   n/a
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   
   If this PR claims a performance improvement, please include evidence such as benchmark results.
   -->
   
   # Are there any user-facing changes?
   no
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   
   If there are any breaking changes to public APIs, please call them out.
   -->
   


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


Re: [PR] docs : add saftey comments [arrow-rs]

Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on code in PR #10843:
URL: https://github.com/apache/arrow-rs/pull/10843#discussion_r3864085060


##########
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:
   this is much cleaner, thanks!



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


Re: [PR] docs : add saftey comments [arrow-rs]

Posted by "Rich-T-kid (via GitHub)" <gi...@apache.org>.
Rich-T-kid commented on PR #10843:
URL: https://github.com/apache/arrow-rs/pull/10843#issuecomment-5427251223

   @Jefffrey https://github.com/apache/arrow-rs/pull/10843/commits/506fcb95937bd0618cde852835b7ec5d33038a3a should address your comments
   


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


Re: [PR] docs : add safety comments [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #10843:
URL: https://github.com/apache/arrow-rs/pull/10843#issuecomment-5433539158

   thanks @Rich-T-kid 


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


Re: [PR] docs : add saftey comments [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] docs : add safety comments [arrow-rs]

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #10843:
URL: https://github.com/apache/arrow-rs/pull/10843


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