* garrow_map_array_new: * @offsets: The offsets Array containing n + 1 offsets encoding length and size. * @keys: The Array containing key values. * @items: The items Array containing item values. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GArrowMapArray * or %NULL on error. * * Since: 0.17.0 */
| 1218 | * Since: 0.17.0 |
| 1219 | */ |
| 1220 | GArrowMapArray * |
| 1221 | garrow_map_array_new(GArrowArray *offsets, |
| 1222 | GArrowArray *keys, |
| 1223 | GArrowArray *items, |
| 1224 | GError **error) |
| 1225 | { |
| 1226 | const auto arrow_offsets = garrow_array_get_raw(offsets); |
| 1227 | const auto arrow_keys = garrow_array_get_raw(keys); |
| 1228 | const auto arrow_items = garrow_array_get_raw(items); |
| 1229 | auto arrow_memory_pool = arrow::default_memory_pool(); |
| 1230 | auto arrow_array_result = arrow::MapArray::FromArrays(arrow_offsets, |
| 1231 | arrow_keys, |
| 1232 | arrow_items, |
| 1233 | arrow_memory_pool); |
| 1234 | if (garrow::check(error, arrow_array_result, "[map-array][new]")) { |
| 1235 | auto arrow_array = *arrow_array_result; |
| 1236 | return GARROW_MAP_ARRAY(garrow_array_new_raw(&arrow_array, |
| 1237 | "array", |
| 1238 | &arrow_array, |
| 1239 | "offsets", |
| 1240 | offsets, |
| 1241 | "keys", |
| 1242 | keys, |
| 1243 | "items", |
| 1244 | items, |
| 1245 | NULL)); |
| 1246 | } else { |
| 1247 | return NULL; |
| 1248 | } |
| 1249 | } |
| 1250 | |
| 1251 | /** |
| 1252 | * garrow_map_array_get_keys: |
nothing calls this directly
no test coverage detected