scovich commented on code in PR #9817:
URL: https://github.com/apache/arrow-rs/pull/9817#discussion_r3148397380
##########
arrow-row/src/lib.rs:
##########
@@ -1255,14 +1255,20 @@ impl Rows {
/// Returns the row at index `row`
pub fn row(&self, row: usize) -> Row<'_> {
- assert!(row + 1 < self.offsets.len());
+ self.checked_row_end(row);
unsafe { self.row_unchecked(row) }
}
+ fn checked_row_end(&self, row: usize) -> usize {
+ row.checked_add(1)
+ .filter(|end| *end < self.offsets.len())
+ .expect("row index out of bounds")
Review Comment:
This PR just replaces an existing `assert!` panic with a new explicit panic
that cannot be optimized away?
--
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]