Hi is there a simple example of creating an ListArray from a vector of strings ?
Best I have is
let s: Vec<Option<String>> = vec![Some("test1".to_string()), Some("test2".to_string())];
let utf8_array = Box::new(Utf8Array::<i64>::from(&s));
let data = ArrayRef::from(utf8_array);
let mut offsets: Vec<i32> = Vec::with_capacity(key_value_strings.len());
for i in 0..key_value_strings.len() {
offsets.push(i as i32);
}
unsafe {
let buffer: Buffer<i32> = offsets.into();
let offsets_buffer = OffsetsBuffer::new_unchecked(buffer);
Box::new(ListArray::try_new(DataType::List(Box::new(DataType::Utf8)), offsets_buffer, data, None).unwrap())
}
Hi is there a simple example of creating an ListArray from a vector of strings ?
Best I have is
the last line
is wrong but because I get
panicked at 'called expects DataType::List")'
Result::unwrap()
on anErr
value: OutOfSpec("ListArrayWhat do I need to put here. PS I am not sure this is how to create a ListArray from Strings. I hate the unsafe part but I am running out of ideas.
Thanks