Skip to content

Add a way to get max usize from OffsetSizeTrait #7474

Closed
@thinkharderdev

Description

@thinkharderdev

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

Came up when working on apache/datafusion#15968. Since working with native code offsets will generally be usize it would be nice to have generic way to get max usize value for OffsetSizeTrait instead of deriving it at runtime

Describe the solution you'd like

pub trait OffsetSizeTrait: ArrowNativeType + std::ops::AddAssign + Integer {
  const MAX_OFFSET:usize
  ...
}

impl OffsetSizeTrait for i32 {
    const MAX_OFFSET: usize = i32::MAX as usize;
    ..
}

impl OffsetSizeTrait for i64 {
    const MAX_OFFSET: usize = i64::MAX as usize;
    ..
}


Describe alternatives you've considered

Can do it like it's done in the above PR by deriving at runtime based on IS_LARGE

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrowChanges to the arrow crateenhancementAny new improvement worthy of a entry in the changelog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions