apache / apache/arrow-rs

Type bound for `V` in `TypedRunArray<'a, R, V>`

Open
#9,459 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
3.6k
Forks
1.3k
Avg merge
2d 18h
Merged PRs (30d)
169

Description

TypedRunArray dfn is simply:

```
pub struct TypedRunArray<'a, R: RunEndIndexType, V> {
/// The run array
run_array: &'a RunArray,

/// The values of the run_array
values: &'a V,
}
```

Strangely enough, there's no constraint about `V`. But in practice, `V: Array`.

Impls involving TypedRunArray mandate that `&'a V: ArrayAccessor`.

**Describe the solution you'd like**

Add either `V: Array` or `where &'a V: ArrayAccessor` in `TypedRunArray` struct definition. I'm not sure which is best. The former is stronger, the latter is more aligned with usages of TypedRunArray in the codebase.

The former requires tweaking many uses of `TypedRunArray` to add the bound, the latter changes nothing (as the bound is currently covered).

**Describe alternatives you've considered**

Keep it as-is.

Contributor guide

Open the contributing guide

Research direction

Start at the TypedRunArray definition and inspect its implementations and usages to compare the Array and ArrayAccessor bounds described in the issue. Choose the bound that best matches the existing API, update any affected uses, and verify that the Rust test suite and compilation pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.