1
2
3
4
5
6
7
8
9
10
11
12
13
use itertools::Itertools;
use vortex_error::VortexResult;

use crate::array::{ChunkedArray, ChunkedEncoding};
use crate::compute::{invert, InvertFn};
use crate::{ArrayDType, ArrayData, IntoArrayData};

impl InvertFn<ChunkedArray> for ChunkedEncoding {
    fn invert(&self, array: &ChunkedArray) -> VortexResult<ArrayData> {
        let chunks = array.chunks().map(|c| invert(&c)).try_collect()?;
        ChunkedArray::try_new(chunks, array.dtype().clone()).map(|a| a.into_array())
    }
}