* garrow_project_node_options_new: * @expressions: (element-type GArrowExpression): * A list of #GArrowExpression to be executed. * @names: (nullable) (array length=n_names): * A list of output column names of @expressions. If @names is %NULL, * the string representations of @expressions will be used. * @n_names: The number of @names. * * Returns: A newly created #GArrowProjectNodeOp
| 1446 | * Since: 11.0.0 |
| 1447 | */ |
| 1448 | GArrowProjectNodeOptions * |
| 1449 | garrow_project_node_options_new(GList *expressions, gchar **names, gsize n_names) |
| 1450 | { |
| 1451 | std::vector<arrow::compute::Expression> arrow_expressions; |
| 1452 | std::vector<std::string> arrow_names; |
| 1453 | for (auto node = expressions; node; node = g_list_next(node)) { |
| 1454 | auto expression = GARROW_EXPRESSION(node->data); |
| 1455 | arrow_expressions.push_back(*garrow_expression_get_raw(expression)); |
| 1456 | } |
| 1457 | for (gsize i = 0; i < n_names; ++i) { |
| 1458 | arrow_names.emplace_back(names[i]); |
| 1459 | } |
| 1460 | if (!arrow_names.empty()) { |
| 1461 | for (size_t i = arrow_names.size(); i < arrow_expressions.size(); ++i) { |
| 1462 | arrow_names.push_back(arrow_expressions[i].ToString()); |
| 1463 | } |
| 1464 | } |
| 1465 | auto arrow_options = |
| 1466 | new arrow::acero::ProjectNodeOptions(arrow_expressions, arrow_names); |
| 1467 | auto options = |
| 1468 | g_object_new(GARROW_TYPE_PROJECT_NODE_OPTIONS, "options", arrow_options, NULL); |
| 1469 | auto priv = GARROW_PROJECT_NODE_OPTIONS_GET_PRIVATE(options); |
| 1470 | priv->expressions = |
| 1471 | g_list_copy_deep(expressions, reinterpret_cast<GCopyFunc>(g_object_ref), nullptr); |
| 1472 | return GARROW_PROJECT_NODE_OPTIONS(options); |
| 1473 | } |
| 1474 | |
| 1475 | /** |
| 1476 | * garrow_project_node_options_get_expressions: |
nothing calls this directly
no test coverage detected