MCPcopy Create free account
hub / github.com/apache/arrow / garrow_array_count

Function garrow_array_count

c_glib/arrow-glib/compute.cpp:4979–4999  ·  view source on GitHub ↗

* garrow_array_count: * @array: A #GArrowArray. * @options: (nullable): A #GArrowCountOptions. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: The number of target values on success. If an error is occurred, * the returned value is untrustful value. * * Since: 0.13.0 */

Source from the content-addressed store, hash-verified

4977 * Since: 0.13.0
4978 */
4979gint64
4980garrow_array_count(GArrowArray *array, GArrowCountOptions *options, GError **error)
4981{
4982 auto arrow_array = garrow_array_get_raw(array);
4983 auto arrow_array_raw = arrow_array.get();
4984 arrow::Result<arrow::Datum> arrow_counted_datum;
4985 if (options) {
4986 auto arrow_options = garrow_count_options_get_raw(options);
4987 arrow_counted_datum = arrow::compute::Count(*arrow_array_raw, *arrow_options);
4988 } else {
4989 arrow_counted_datum = arrow::compute::Count(*arrow_array_raw);
4990 }
4991 if (garrow::check(error, arrow_counted_datum, "[array][count]")) {
4992 using ScalarType = typename arrow::TypeTraits<arrow::Int64Type>::ScalarType;
4993 auto arrow_counted_scalar =
4994 std::dynamic_pointer_cast<ScalarType>((*arrow_counted_datum).scalar());
4995 return arrow_counted_scalar->value;
4996 } else {
4997 return 0;
4998 }
4999}
5000
5001/**
5002 * garrow_array_count_values:

Callers

nothing calls this directly

Calls 6

CountFunction · 0.85
garrow_array_get_rawFunction · 0.70
checkFunction · 0.70
getMethod · 0.45
scalarMethod · 0.45

Tested by

no test coverage detected