| 170 | } |
| 171 | |
| 172 | PivotLongerNode(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 173 | std::shared_ptr<Schema> output_schema, PivotLongerNodeOptions options, |
| 174 | std::vector<BoundRowTemplate> templates) |
| 175 | : ExecNode(plan, std::move(inputs), {"input"}, std::move(output_schema)), |
| 176 | TracedNode(this), |
| 177 | options_(std::move(options)), |
| 178 | templates_(std::move(templates)) { |
| 179 | // Relies on the fact that the measurement types are the last fields |
| 180 | // in the output schema. |
| 181 | std::size_t num_out_fields = output_schema_->fields().size(); |
| 182 | std::size_t num_measurements = options_.measurement_field_names.size(); |
| 183 | std::size_t meas_offset = num_out_fields - num_measurements; |
| 184 | for (std::size_t i = 0; i < num_measurements; i++) { |
| 185 | meas_types_.push_back(output_schema_->fields()[meas_offset + i]->type()); |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | static Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 190 | const ExecNodeOptions& options) { |