Function arrow_select::interleave::interleave
source · pub fn interleave(
values: &[&dyn Array],
indices: &[(usize, usize)],
) -> Result<ArrayRef, ArrowError>
Expand description
Takes elements by index from a list of Array
, creating a new Array
from those values.
Each element in indices
is a pair of usize
with the first identifying the index
of the Array
in values
, and the second the index of the value within that Array
┌─────────────────┐ ┌─────────┐ ┌─────────────────┐
│ A │ │ (0, 0) │ interleave( │ A │
├─────────────────┤ ├─────────┤ [values0, values1], ├─────────────────┤
│ D │ │ (1, 0) │ indices │ B │
└─────────────────┘ ├─────────┤ ) ├─────────────────┤
values array 0 │ (1, 1) │ ─────────────────────────▶ │ C │
├─────────┤ ├─────────────────┤
│ (0, 1) │ │ D │
└─────────┘ └─────────────────┘
┌─────────────────┐ indices
│ B │ array
├─────────────────┤ result
│ C │
├─────────────────┤
│ E │
└─────────────────┘
values array 1
For selecting values by index from a single array see crate::interleave