Concatenate ListArray
TEST(TestConcatenate, ListType) {
auto nestype = list(arrow::int8());
auto array1 = ArrayFromJSON(nestype, "[[1, 2], [3, 4]]");
auto array2 = ArrayFromJSON(nestype, "[[5, 6, 7], null]");
auto array3 = ArrayFromJSON(nestype, "[[8], [9, 10]]");
// ARROW_ASSIGN_OR_RAISE(auto bigArr, Concatenate({array1, array2, array3}, default_memory_pool()));
ASSERT_OK_AND_ASSIGN(auto bigArr, Concatenate({array1, array2, array3}, default_memory_pool()));
std::cout << "bigArr->ToString()\n:" << bigArr->ToString() << std::endl;
std::cout << "bigArr->length()\n:" << bigArr->length() << std::endl;
}
./arrow-array-test --gtest_filter=TestConcatenate.ListType
bigArr->ToString()
[
[
1,
2
],
[
3,
4
],
[
5,
6,
7
],
null,
[
8
],
[
9,
10
]
]
bigArr->length()
:6
Concatenate MapArray
TEST(TestConcatenate, MapType) {
auto nestype = map(utf8(), utf8());
// auto array1 = ArrayFromJSON(nestype, R"([[["name1", "alice1"]]])");
// auto array2 = ArrayFromJSON(nestype, R"([[["name2", "alice2"]]])");
// auto array3 = ArrayFromJSON(nestype, R"([[["name3", "alice3"]]])");
auto array1 = ArrayFromJSON(nestype, R"([[["name1", "alice1"]], [["name2", "alice2"]]])");
auto array2 = ArrayFromJSON(nestype, R"([[["name1", "alice1"]], [["name2", "alice2"]]])");
auto array3 = ArrayFromJSON(nestype, R"([[["name1", "alice1"]], [["name2", "alice2"]]])");
// ARROW_ASSIGN_OR_RAISE(auto bigArr, Concatenate({array1, array2, array3}, default_memory_pool()));
ASSERT_OK_AND_ASSIGN(auto bigArr, Concatenate({array1, array2, array3}, default_memory_pool()));
std::cout << "bigArr->ToString()\n:" << bigArr->ToString() << std::endl;
std::cout << "bigArr->length()\n:" << bigArr->length() << std::endl;
}
./arrow-array-test --gtest_filter=TestConcatenate.MapType
bigArr->ToString()
[
keys:
[
"name1"
]
values:
[
"alice1"
],
keys:
[
"name2"
]
values:
[
"alice2"
],
keys:
[
"name1"
]
values:
[
"alice1"
],
keys:
[
"name2"
]
values:
[
"alice2"
],
keys:
[
"name1"
]
values:
[
"alice1"
],
keys:
[
"name2"
]
values:
[
"alice2"
]
]
bigArr->length()
:6
|