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

Method Make

cpp/src/arrow/acero/project_node.cc:50–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 exprs_(std::move(exprs)) {}
49
50 static Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs,
51 const ExecNodeOptions& options) {
52 RETURN_NOT_OK(ValidateExecNodeInputs(plan, inputs, 1, "ProjectNode"));
53
54 const auto& project_options = checked_cast<const ProjectNodeOptions&>(options);
55 auto exprs = project_options.expressions;
56 auto names = project_options.names;
57
58 if (names.size() == 0) {
59 names.resize(exprs.size());
60 for (size_t i = 0; i < exprs.size(); ++i) {
61 names[i] = exprs[i].ToString();
62 }
63 } else {
64 ARROW_RETURN_IF(
65 names.size() != exprs.size(),
66 Status::Invalid("Project node's size of names " + std::to_string(names.size()) +
67 " doesn't match size of expressions " +
68 std::to_string(exprs.size())));
69 }
70 FieldVector fields(exprs.size());
71 int i = 0;
72 for (auto& expr : exprs) {
73 if (!expr.IsBound()) {
74 ARROW_ASSIGN_OR_RAISE(expr, expr.Bind(*inputs[0]->output_schema(),
75 plan->query_context()->exec_context()));
76 }
77 fields[i] = field(std::move(names[i]), expr.type()->GetSharedPtr());
78 ++i;
79 }
80 return plan->EmplaceNode<ProjectNode>(plan, std::move(inputs),
81 schema(std::move(fields)), std::move(exprs));
82 }
83
84 const char* kind_name() const override { return "ProjectNode"; }
85

Callers

nothing calls this directly

Calls 14

ValidateExecNodeInputsFunction · 0.85
to_stringFunction · 0.85
resizeMethod · 0.80
IsBoundMethod · 0.80
exec_contextMethod · 0.80
query_contextMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
InvalidFunction · 0.50
fieldFunction · 0.50
schemaFunction · 0.50
sizeMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected