1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use vortex_array::compute::{invert, InvertFn};
use vortex_array::{ArrayData, ArrayLen, IntoArrayData};
use vortex_error::VortexResult;

use crate::{RunEndArray, RunEndEncoding};

impl InvertFn<RunEndArray> for RunEndEncoding {
    fn invert(&self, array: &RunEndArray) -> VortexResult<ArrayData> {
        RunEndArray::with_offset_and_length(
            array.ends(),
            invert(&array.values())?,
            array.len(),
            array.offset(),
        )
        .map(|a| a.into_array())
    }
}