Module cast

Source
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
CastOptions provides a way to override the default cast behaviors

Functionsยง

adjust_timestamp_to_timezone ๐Ÿ”’
as_time_res_with_timezone ๐Ÿ”’
bool_to_numeric_cast ๐Ÿ”’
can_cast_types
Return true if a value of type from_type can be cast into a value of to_type.
cast
Cast array to the provided data type and return a new Array with type to_type, if possible.
cast_binary_to_fixed_size_binary ๐Ÿ”’
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 one ByteArrayType 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_duration_to_interval ๐Ÿ”’
Cast the array from duration and interval
cast_fixed_size_binary_to_binary ๐Ÿ”’
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_from_decimal ๐Ÿ”’
cast_integer_to_decimal ๐Ÿ”’
cast_interval_day_time_to_interval_month_day_nano ๐Ÿ”’
Cast the array from interval day time to month day nano
cast_interval_year_month_to_interval_month_day_nano ๐Ÿ”’
Cast the array from interval year month to month day nano
cast_month_day_nano_to_duration ๐Ÿ”’
Cast the array from interval to duration
cast_numeric_arrays ๐Ÿ”’
Convert Array into a PrimitiveArray of type, and apply numeric cast
cast_numeric_to_binary ๐Ÿ”’
cast_numeric_to_bool ๐Ÿ”’
Cast numeric types to Boolean
cast_reinterpret_arrays ๐Ÿ”’
Cast the primitive array using [PrimitiveArray::reinterpret_cast]
cast_to_decimal ๐Ÿ”’
cast_view_to_byte ๐Ÿ”’
Helper function to cast from one ByteViewType array to ByteArrayType array.
cast_with_options
Try to cast array to to_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 ๐Ÿ”’