* garrow_function_execute: * @function: A #GArrowFunction. * @args: (element-type GArrowDatum): A list of #GArrowDatum. * @options: (nullable): Options for the execution as an object that * implements #GArrowFunctionOptions. * @context: (nullable): A #GArrowExecuteContext for the execution. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable) (transfer f
| 835 | * Since: 1.0.0 |
| 836 | */ |
| 837 | GArrowDatum * |
| 838 | garrow_function_execute(GArrowFunction *function, |
| 839 | GList *args, |
| 840 | GArrowFunctionOptions *options, |
| 841 | GArrowExecuteContext *context, |
| 842 | GError **error) |
| 843 | { |
| 844 | auto arrow_function = garrow_function_get_raw(function); |
| 845 | std::vector<arrow::Datum> arrow_args; |
| 846 | for (GList *node = args; node; node = node->next) { |
| 847 | GArrowDatum *datum = GARROW_DATUM(node->data); |
| 848 | arrow_args.push_back(garrow_datum_get_raw(datum)); |
| 849 | } |
| 850 | const arrow::compute::FunctionOptions *arrow_options; |
| 851 | if (options) { |
| 852 | arrow_options = garrow_function_options_get_raw(options); |
| 853 | } else { |
| 854 | arrow_options = arrow_function->default_options(); |
| 855 | } |
| 856 | arrow::Result<arrow::Datum> arrow_result_result; |
| 857 | if (context) { |
| 858 | auto arrow_context = garrow_execute_context_get_raw(context); |
| 859 | arrow_result_result = |
| 860 | arrow_function->Execute(arrow_args, arrow_options, arrow_context); |
| 861 | } else { |
| 862 | arrow::compute::ExecContext arrow_context; |
| 863 | arrow_result_result = |
| 864 | arrow_function->Execute(arrow_args, arrow_options, &arrow_context); |
| 865 | } |
| 866 | if (garrow::check(error, arrow_result_result, "[function][execute]")) { |
| 867 | auto arrow_result = *arrow_result_result; |
| 868 | return garrow_datum_new_raw(&arrow_result); |
| 869 | } else { |
| 870 | return NULL; |
| 871 | } |
| 872 | } |
| 873 | |
| 874 | /** |
| 875 | * garrow_function_get_name: |
nothing calls this directly
no test coverage detected