Skip to content

How to construct array of list of list and array of list of struct? #6631

Closed Answered by tisonkun
tisonkun asked this question in Q&A
Discussion options

You must be logged in to vote

Found:

    use arrow::array::{Int32Builder, Int64Builder, StructBuilder};
    use arrow::array::ListBuilder;
    use arrow::datatypes::DataType;
    use arrow::datatypes::Field;
    use arrow::datatypes::Fields;

    use super::*;

    #[test]
    fn test_list_array_of_list() {
        let mut builder = ListBuilder::new(ListBuilder::new(Int64Builder::new()));
        builder.values().append_value([Some(1), None, Some(3)]);
        builder.values().append_null();
        builder.append(true);
        builder.values().append_value([Some(4)]);
        builder.values().append_value([]);
        builder.append(true);
        builder.values().append_value([Some(5), Some(6)]);
        builder.va…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by tisonkun
Comment options

You must be logged in to vote
0 replies
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