* garrow_struct_array_flatten * @array: A #GArrowStructArray. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (element-type GArrowArray) (transfer full): * The fields in the struct. * * Since: 0.10.0 */
| 1055 | * Since: 0.10.0 |
| 1056 | */ |
| 1057 | GList * |
| 1058 | garrow_struct_array_flatten(GArrowStructArray *array, GError **error) |
| 1059 | { |
| 1060 | const auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); |
| 1061 | auto arrow_struct_array = std::static_pointer_cast<arrow::StructArray>(arrow_array); |
| 1062 | |
| 1063 | auto memory_pool = arrow::default_memory_pool(); |
| 1064 | auto arrow_arrays = arrow_struct_array->Flatten(memory_pool); |
| 1065 | if (!garrow::check(error, arrow_arrays, "[struct-array][flatten]")) { |
| 1066 | return NULL; |
| 1067 | } |
| 1068 | |
| 1069 | GList *arrays = NULL; |
| 1070 | for (auto arrow_array : *arrow_arrays) { |
| 1071 | auto array = garrow_array_new_raw(&arrow_array); |
| 1072 | arrays = g_list_prepend(arrays, array); |
| 1073 | } |
| 1074 | |
| 1075 | return g_list_reverse(arrays); |
| 1076 | } |
| 1077 | |
| 1078 | typedef struct GArrowMapArrayPrivate_ |
| 1079 | { |
nothing calls this directly
no test coverage detected