This is an automated email from the ASF dual-hosted git repository.
thinkharderdev pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new ab4571948a Add const MAX_OFFSET to OffsetSizeTrait (#7478)
ab4571948a is described below
commit ab4571948a259c11f576d7891c20c5befd8904b2
Author: Dan Harris <[email protected]>
AuthorDate: Wed May 7 12:47:41 2025 -0400
Add const MAX_OFFSET to OffsetSizeTrait (#7478)
---
arrow-array/src/array/list_array.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arrow-array/src/array/list_array.rs
b/arrow-array/src/array/list_array.rs
index 009a7b7a50..7962777656 100644
--- a/arrow-array/src/array/list_array.rs
+++ b/arrow-array/src/array/list_array.rs
@@ -42,16 +42,20 @@ pub trait OffsetSizeTrait: ArrowNativeType +
std::ops::AddAssign + Integer {
const IS_LARGE: bool;
/// Prefix for the offset size
const PREFIX: &'static str;
+ /// The max `usize` offset
+ const MAX_OFFSET: usize;
}
impl OffsetSizeTrait for i32 {
const IS_LARGE: bool = false;
const PREFIX: &'static str = "";
+ const MAX_OFFSET: usize = i32::MAX as usize;
}
impl OffsetSizeTrait for i64 {
const IS_LARGE: bool = true;
const PREFIX: &'static str = "Large";
+ const MAX_OFFSET: usize = i64::MAX as usize;
}
/// An array of [variable length lists], similar to JSON arrays