You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "rluvaton (via GitHub)" <gi...@apache.org> on 2026/01/27 16:59:59 UTC

[PR] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

rluvaton opened a new pull request, #9278:
URL: https://github.com/apache/arrow-rs/pull/9278

   # Which issue does this PR close?
   
   None
   
   # Rationale for this change
   
   I want to add some optimizations that uses `get_unchecked` but the safety comment says that we panic on out of range access which might not be the case for `get_unchecked`
   
   # What changes are included in this PR?
   
   Update safety note
   
   # Are these changes tested?
   
   No
   
   # Are there any user-facing changes?
   
   Yes, we no longer guarantee that out of range will panic and instead it can lead to undefined behavior, which the user might not be able to catch


-- 
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] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #9278:
URL: https://github.com/apache/arrow-rs/pull/9278#discussion_r2738914109


##########
arrow-select/src/take.rs:
##########
@@ -63,7 +63,7 @@ use num_traits::{One, Zero};
 ///
 /// # Safety
 ///
-/// When `options` is not set to check bounds, taking indexes after `len` will panic.
+/// When `options` is not set to check bounds, taking indexes after `len` is *undefined behavior*.

Review Comment:
   Maybe we need to add a `fn unsafe take_unchecked` 🤔 



-- 
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] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #9278:
URL: https://github.com/apache/arrow-rs/pull/9278#issuecomment-4795285613

   Thank you for your contribution. Unfortunately, this pull request is stale because it has been open 60 days with no activity. Please remove the stale label or comment or this will be closed in 7 days.


-- 
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] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

Posted by "Dandandan (via GitHub)" <gi...@apache.org>.
Dandandan commented on code in PR #9278:
URL: https://github.com/apache/arrow-rs/pull/9278#discussion_r2733049094


##########
arrow-select/src/take.rs:
##########
@@ -63,7 +63,7 @@ use num_traits::{One, Zero};
 ///
 /// # Safety
 ///
-/// When `options` is not set to check bounds, taking indexes after `len` will panic.
+/// When `options` is not set to check bounds, taking indexes after `len` is *undefined behavior*.

Review Comment:
   We can't just document that something is UB (we would need to mark the code as `unsafe` as well and need to assure we never pass OOB indices).



-- 
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] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

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

   Yes I also agree


-- 
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] doc: change take index out of range access to be undefined behavior and not guarantee panic [arrow-rs]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #9278: doc: change take index out of range access to be undefined behavior and not guarantee panic
URL: https://github.com/apache/arrow-rs/pull/9278


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