* 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 */
| 4946 | * Since: 0.8.0 |
| 4947 | */ |
| 4948 | GArrowDictionaryArray * |
| 4949 | garrow_array_dictionary_encode(GArrowArray *array, GError **error) |
| 4950 | { |
| 4951 | auto arrow_array = garrow_array_get_raw(array); |
| 4952 | auto arrow_dictionary_encoded_datum = arrow::compute::DictionaryEncode(arrow_array); |
| 4953 | if (garrow::check(error, arrow_dictionary_encoded_datum, [&]() { |
| 4954 | std::stringstream message; |
| 4955 | message << "[array][dictionary-encode] <"; |
| 4956 | message << arrow_array->type()->ToString(); |
| 4957 | message << ">"; |
| 4958 | return message.str(); |
| 4959 | })) { |
| 4960 | auto arrow_dictionary_encoded_array = (*arrow_dictionary_encoded_datum).make_array(); |
| 4961 | auto dictionary_encoded_array = garrow_array_new_raw(&arrow_dictionary_encoded_array); |
| 4962 | return GARROW_DICTIONARY_ARRAY(dictionary_encoded_array); |
| 4963 | } else { |
| 4964 | return NULL; |
| 4965 | } |
| 4966 | } |
| 4967 | |
| 4968 | /** |
| 4969 | * garrow_array_count: |
nothing calls this directly
no test coverage detected