* garrow_array_dictionary_encode: * @array: A #GArrowArray. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable) (transfer full): * A newly created #GArrowDictionaryArray for the @array on success, * %NULL on error. * * Since: 0.8.0 */
| 4991 | * Since: 0.8.0 |
| 4992 | */ |
| 4993 | GArrowDictionaryArray * |
| 4994 | garrow_array_dictionary_encode(GArrowArray *array, GError **error) |
| 4995 | { |
| 4996 | auto arrow_array = garrow_array_get_raw(array); |
| 4997 | auto arrow_dictionary_encoded_datum = arrow::compute::DictionaryEncode(arrow_array); |
| 4998 | if (garrow::check(error, arrow_dictionary_encoded_datum, [&]() { |
| 4999 | std::stringstream message; |
| 5000 | message << "[array][dictionary-encode] <"; |
| 5001 | message << arrow_array->type()->ToString(); |
| 5002 | message << ">"; |
| 5003 | return message.str(); |
| 5004 | })) { |
| 5005 | auto arrow_dictionary_encoded_array = (*arrow_dictionary_encoded_datum).make_array(); |
| 5006 | auto dictionary_encoded_array = garrow_array_new_raw(&arrow_dictionary_encoded_array); |
| 5007 | return GARROW_DICTIONARY_ARRAY(dictionary_encoded_array); |
| 5008 | } else { |
| 5009 | return NULL; |
| 5010 | } |
| 5011 | } |
| 5012 | |
| 5013 | /** |
| 5014 | * garrow_array_count: |
nothing calls this directly
no test coverage detected