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

Function garrow_project_node_options_new

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

* 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

Source from the content-addressed store, hash-verified

1446 * Since: 11.0.0
1447 */
1448GArrowProjectNodeOptions *
1449garrow_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:

Callers

nothing calls this directly

Calls 6

push_backMethod · 0.80
emplace_backMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected