| 147 | } |
| 148 | |
| 149 | PivotLongerNode(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 150 | std::shared_ptr<Schema> output_schema, PivotLongerNodeOptions options, |
| 151 | std::vector<BoundRowTemplate> templates) |
| 152 | : ExecNode(plan, std::move(inputs), {"input"}, std::move(output_schema)), |
| 153 | TracedNode(this), |
| 154 | options_(std::move(options)), |
| 155 | templates_(std::move(templates)) { |
| 156 | // Relies on the fact that the measurement types are the last fields |
| 157 | // in the output schema. |
| 158 | std::size_t num_out_fields = output_schema_->fields().size(); |
| 159 | std::size_t num_measurements = options_.measurement_field_names.size(); |
| 160 | std::size_t meas_offset = num_out_fields - num_measurements; |
| 161 | for (std::size_t i = 0; i < num_measurements; i++) { |
| 162 | meas_types_.push_back(output_schema_->fields()[meas_offset + i]->type()); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | static Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> inputs, |
| 167 | const ExecNodeOptions& options) { |