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

Method ApplyTemplate

cpp/src/arrow/acero/pivot_longer_node.cc:235–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233 Status StopProducingImpl() override { return Status::OK(); }
234
235 ExecBatch ApplyTemplate(const BoundRowTemplate& templ, const ExecBatch& input) const {
236 std::vector<Datum> values(input.values);
237 for (const auto& feature_val : templ.feature_values) {
238 // Feature names are added as string scalars
239 values.push_back(Datum(feature_val));
240 }
241 for (std::size_t meas_idx = 0; meas_idx < templ.measurement_paths.size();
242 meas_idx++) {
243 const std::optional<FieldPath>& opt_meas_path = templ.measurement_paths[meas_idx];
244 if (opt_meas_path) {
245 values.push_back(input.values[opt_meas_path->indices()[0]]);
246 } else {
247 values.push_back(MakeNullScalar(meas_types_[meas_idx]));
248 }
249 }
250 return ExecBatch(std::move(values), input.length);
251 }
252
253 Status InputReceived(ExecNode* input, ExecBatch batch) override {
254 auto scope = TraceInputReceived(batch);

Callers

nothing calls this directly

Calls 6

MakeNullScalarFunction · 0.85
push_backMethod · 0.80
indicesMethod · 0.80
DatumClass · 0.50
ExecBatchFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected