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

Function garrow_array_count

c_glib/arrow-glib/compute.cpp:5024–5044  ·  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

5022 * Since: 0.13.0
5023 */
5024gint64
5025garrow_array_count(GArrowArray *array, GArrowCountOptions *options, GError **error)
5026{
5027 auto arrow_array = garrow_array_get_raw(array);
5028 auto arrow_array_raw = arrow_array.get();
5029 arrow::Result<arrow::Datum> arrow_counted_datum;
5030 if (options) {
5031 auto arrow_options = garrow_count_options_get_raw(options);
5032 arrow_counted_datum = arrow::compute::Count(*arrow_array_raw, *arrow_options);
5033 } else {
5034 arrow_counted_datum = arrow::compute::Count(*arrow_array_raw);
5035 }
5036 if (garrow::check(error, arrow_counted_datum, "[array][count]")) {
5037 using ScalarType = typename arrow::TypeTraits<arrow::Int64Type>::ScalarType;
5038 auto arrow_counted_scalar =
5039 std::dynamic_pointer_cast<ScalarType>((*arrow_counted_datum).scalar());
5040 return arrow_counted_scalar->value;
5041 } else {
5042 return 0;
5043 }
5044}
5045
5046/**
5047 * 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