* garrow_schema_replace_field: * @schema: A #GArrowSchema. * @i: The index of the field to be replaced. * @field: The newly added #GArrowField. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable) (transfer full): The newly allocated * #GArrowSchema that has @field as the @i-th field or %NULL on error. * * Since: 0.10.0 */
| 388 | * Since: 0.10.0 |
| 389 | */ |
| 390 | GArrowSchema * |
| 391 | garrow_schema_replace_field(GArrowSchema *schema, |
| 392 | guint i, |
| 393 | GArrowField *field, |
| 394 | GError **error) |
| 395 | { |
| 396 | const auto arrow_schema = garrow_schema_get_raw(schema); |
| 397 | const auto arrow_field = garrow_field_get_raw(field); |
| 398 | auto maybe_new_schema = arrow_schema->SetField(i, arrow_field); |
| 399 | if (garrow::check(error, maybe_new_schema, "[schema][replace-field]")) { |
| 400 | return garrow_schema_new_raw(&(*maybe_new_schema)); |
| 401 | } else { |
| 402 | return NULL; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * garrow_schema_has_metadata: |
nothing calls this directly
no test coverage detected