| 42 | |
| 43 | template <typename ArrowType, typename GArrowArrayType> |
| 44 | typename ArrowType::c_type |
| 45 | garrow_numeric_array_sum(GArrowArrayType array, |
| 46 | GError **error, |
| 47 | const gchar *tag, |
| 48 | typename ArrowType::c_type default_value) |
| 49 | { |
| 50 | auto arrow_array = garrow_array_get_raw(GARROW_ARRAY(array)); |
| 51 | auto arrow_sum_datum = arrow::compute::Sum(arrow_array); |
| 52 | if (garrow::check(error, arrow_sum_datum, tag)) { |
| 53 | using ScalarType = typename arrow::TypeTraits<ArrowType>::ScalarType; |
| 54 | auto arrow_numeric_scalar = |
| 55 | std::dynamic_pointer_cast<ScalarType>((*arrow_sum_datum).scalar()); |
| 56 | if (arrow_numeric_scalar->is_valid) { |
| 57 | return arrow_numeric_scalar->value; |
| 58 | } else { |
| 59 | return default_value; |
| 60 | } |
| 61 | } else { |
| 62 | return default_value; |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | template <typename GArrowTypeNewRaw> |
| 67 | auto |
nothing calls this directly
no test coverage detected