vortex_array/arrays/extension/vtable/
operations.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use std::ops::Range;
5
6use vortex_scalar::Scalar;
7
8use crate::arrays::extension::{ExtensionArray, ExtensionVTable};
9use crate::vtable::OperationsVTable;
10use crate::{ArrayRef, IntoArray};
11
12impl OperationsVTable<ExtensionVTable> for ExtensionVTable {
13    fn slice(array: &ExtensionArray, range: Range<usize>) -> ArrayRef {
14        ExtensionArray::new(array.ext_dtype().clone(), array.storage().slice(range)).into_array()
15    }
16
17    fn scalar_at(array: &ExtensionArray, index: usize) -> Scalar {
18        Scalar::extension(array.ext_dtype().clone(), array.storage().scalar_at(index))
19    }
20}