You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Hi! While I can very easily modify in place a PrimitiveArray with get_mut_values, I am struggling to modify in place a FixedSizeListArray. I did the code below trying to get a mutable reference to the inner Array or even to get a MutableFixedSizeListArray to no avail. What am I missing here?
Works
let mut primitive_array =
PrimitiveArray::from_vec(vec![1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12.]);
let b = primitive_array.get_mut_values().unwrap();
b[0] = 10.;
Doesn't work. Returns None on the last line.
let array: PrimitiveArray<f32> =
PrimitiveArray::from_vec(vec![1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12.]);
let field = Box::new(Field::new("item", array.data_type().clone(), true));
let mut fixedlist =
FixedSizeListArray::try_new(DataType::FixedSizeList(field, 3), Box::new(array), None)
.unwrap();
let a = fixedlist
.as_any_mut()
.downcast_mut::<MutableFixedSizeListArray<MutablePrimitiveArray<f32>>>()
.unwrap();
Doesn't work. Compiler complain because no conversion is implemented on last line.
let array: PrimitiveArray<f32> =
PrimitiveArray::from_vec(vec![1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12.]);
let field = Box::new(Field::new("item", array.data_type().clone(), true));
let mut fixedlist =
FixedSizeListArray::try_new(DataType::FixedSizeList(field, 3), Box::new(array), None)
.unwrap();
let a: MutableFixedSizeListArray<MutablePrimitiveArray<f32>> = fixedlist.into();
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi! While I can very easily modify in place a PrimitiveArray with
get_mut_values
, I am struggling to modify in place aFixedSizeListArray
. I did the code below trying to get a mutable reference to the innerArray
or even to get aMutableFixedSizeListArray
to no avail. What am I missing here?Works
Doesn't work. Returns None on the last line.
Doesn't work. Compiler complain because no conversion is implemented on last line.
Beta Was this translation helpful? Give feedback.
All reactions