pub fn take<IndexType>(
    values: &dyn Array,
    indices: &PrimitiveArray<IndexType>,
    options: Option<TakeOptions>,
) -> Result<ArrayRef>
where
    IndexType: ArrowNumericType,
    IndexType::Native: ToPrimitive,
{
    take_impl(values, indices, options)
}
/// Take elements by index from [Array], creating a new [Array] from those indexes.
///
/// # Errors
/// This function errors whenever:
/// * An index cannot be casted to `usize` (typically 32 bit architectures)
/// * An index is out of bounds and `options` is set to check bounds.
/// # Safety
/// When `options` is not set to check bounds (default), taking indexes after `len` is undefined behavior.
/// # Examples
/// ```
/// use arrow::array::{StringArray, UInt32Array};
/// use arrow::error::Result;
/// use arrow::compute::take;
/// # fn main() -> Result<()> {
/// let values = StringArray::from(vec!["zero", "one", "two"]);
///
/// // Take items at index 2, and 1:
/// let indices = UInt32Array::from(vec![2, 1]);
/// let taken = take(&values, &indices, None)?;
/// let taken = taken.as_any().downcast_ref::<StringArray>().unwrap();
///
/// assert_eq!(*taken, StringArray::from(vec!["two", "one"]));
/// # Ok(())
/// # }
/// ```
Take elements by index from [Array], creating a new [Array] from those indexes.
Take elements by index from [ Array ] creating a new [ Array ] from those indexes .
pub fn take<IndexType>(
    values: &dyn Array,
    indices: &PrimitiveArray<IndexType>,
    options: Option<TakeOptions>,
) -> Result<ArrayRef>
where
    IndexType: ArrowNumericType,
    IndexType::Native: ToPrimitive,
{
    take_impl(values, indices, options)
}
pub fn take < IndexType > ( values : & dyn Array , indices : & PrimitiveArray < IndexType > , options : Option < TakeOptions > , ) -> Result < ArrayRef > where IndexType : ArrowNumericType , IndexType :: Native : ToPrimitive , { take_impl ( values , indices , options ) }
Take elements by index from [Array], creating a new [Array] from those indexes.
Take elements by index from [ Array ] creating a new [ Array ] from those indexes .
values
&dyn Array
indices
&PrimitiveArray<IndexType>
options
Option<TakeOptions>
values
&dyn Array
indices
&PrimitiveArray<IndexType>
options
Option<TakeOptions>
errors
This function errors whenever:
An index cannot be casted to `usize` (typically 32 bit architectures)
An index is out of bounds and `options` is set to check bounds.
This function errors whenever : An index cannot be casted to ` usize ` ( typically 32 bit architectures ) An index is out of bounds and ` options ` is set to check bounds .
safety
When `options` is not set to check bounds (default), taking indexes after `len` is undefined behavior.
When ` options ` is not set to check bounds ( default ) taking indexes after ` len ` is undefined behavior .
examples
```
use arrow::array::{StringArray, UInt32Array};
use arrow::error::Result;
use arrow::compute::take.
` ` ` use arrow :: array :: { StringArray UInt32Array } ; use arrow :: error :: Result ; use arrow :: compute :: take .
fn main() -> result<()> {
let values = StringArray::from(vec!["zero", "one", "two"]).

Take items at index 2, and 1:
let indices = UInt32Array::from(vec![2, 1]);
let taken = take(&values, &indices, None)?;
let taken = taken.as_any().downcast_ref::().unwrap().

assert_eq!(*taken, StringArray::from(vec!["two", "one"])).
let values = StringArray :: from ( vec! [ " zero " " one " " two " ] ) . Take items at index 2 and 1 : let indices = UInt32Array :: from ( vec! [ 2 1 ] ) ; let taken = take ( &values &indices None ) ? ; let taken = taken . as_any () . downcast_ref :: () . unwrap () . assert_eq! ( * taken StringArray :: from ( vec! [ " two " " one " ] )) .
ok(())
None
}
None