Skip to content
Discussion options

You must be logged in to vote

String is not a primitive type and can't use from_iter_primitive, instead, use ListArray::try_new()/new() or ListBuilder.

 use crate::arrow::buffer::OffsetBuffer;
 async fn test_datafustion() -> Result<()> {
        // define a schema.
        let item_field = Arc::new(Field::new("property", DataType::Utf8, false));
        let schema = Arc::new(Schema::new(vec![
            Field::new("id", DataType::Utf8, false),
            Field::new_list("properties", item_field.clone(), true),
        ]));
        let string_arry = StringArray::from(vec!["a", "a", "b", "b", "c", "c", "d", "d"]);
        let offsets = OffsetBuffer::new(vec![0, 2, 4, 6, 8].into());
        let list_array = ListArray::new

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jefffrey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants