Expand description
Cast kernels to convert [ArrayRef
] between supported datatypes.
See cast_with_options
for more information on specific conversions.
Example:
// int32 to float64
let a = Int32Array::from(vec![5, 6, 7]);
let b = cast(&a, &DataType::Float64).unwrap();
let c = b.as_primitive::<Float64Type>();
assert_eq!(5.0, c.value(0));
assert_eq!(6.0, c.value(1));
assert_eq!(7.0, c.value(2));
Modulesยง
- decimal ๐
- dictionary ๐
- list ๐
- map ๐
- string ๐
Structsยง
- CastOptions provides a way to override the default cast behaviors
Functionsยง
- bool_
to_ ๐numeric_ cast - Return true if a value of type
from_type
can be cast into a value ofto_type
. - Cast
array
to the provided data type and return a new Array with typeto_type
, if possible. - Helper function to cast from one
BinaryArray
or โLargeBinaryArrayโ to โFixedSizeBinaryArrayโ. - cast_
bool_ ๐to_ numeric Cast Boolean types to numeric - cast_
byte_ ๐container Helper function to cast from oneByteArrayType
to another and vice versa. If the target one (e.g.,LargeUtf8
) is too large for the source array it will return an Error. - Cast the array from duration and interval
- Helper function to cast from โFixedSizeBinaryArrayโ to one
BinaryArray
or โLargeBinaryArrayโ. If the target one is too large for the source array it will return an Error. - Cast the array from interval day time to month day nano
- Cast the array from interval year month to month day nano
- Cast the array from interval to duration
- cast_
numeric_ ๐arrays Convert Array into a PrimitiveArray of type, and apply numeric cast - cast_
numeric_ ๐to_ bool Cast numeric types to Boolean - Cast the primitive array using [
PrimitiveArray::reinterpret_cast
] - cast_
view_ ๐to_ byte Helper function to cast from oneByteViewType
array toByteArrayType
array. - Try to cast
array
toto_type
if possible. - make_
duration_ ๐array - make_
timestamp_ ๐array - numeric_
cast ๐ - numeric_
to_ ๐bool_ cast - time_
unit_ ๐multiple Get the time unit as a multiple of a second - timestamp_
to_ ๐date32 - try_
numeric_ ๐cast