| 226 | } |
| 227 | |
| 228 | std::shared_ptr<SortingStep> SortingStep::fromProto(const Protos::SortingStep & proto, ContextPtr) |
| 229 | { |
| 230 | auto [step_description, base_input_stream] = ITransformingStep::deserializeFromProtoBase(proto.query_plan_base()); |
| 231 | SortDescription result_description; |
| 232 | for (const auto & proto_element : proto.result_description()) |
| 233 | { |
| 234 | SortColumnDescription element; |
| 235 | element.fillFromProto(proto_element); |
| 236 | result_description.emplace_back(std::move(element)); |
| 237 | } |
| 238 | |
| 239 | Stage stage = Stage::FULL; |
| 240 | if (proto.has_stage()) |
| 241 | stage = StageConverter::fromProto(proto.stage()); |
| 242 | |
| 243 | auto limit = proto.limit(); |
| 244 | auto limit_or_var = getSizeOrVariableFromProto(proto.limit_or_var()); |
| 245 | SortDescription prefix_description; |
| 246 | for (const auto & proto_element : proto.prefix_description()) |
| 247 | { |
| 248 | SortColumnDescription element; |
| 249 | element.fillFromProto(proto_element); |
| 250 | prefix_description.emplace_back(std::move(element)); |
| 251 | } |
| 252 | auto step = std::make_shared<SortingStep>(base_input_stream, result_description, limit_or_var ? *limit_or_var : limit, stage, prefix_description); |
| 253 | step->setStepDescription(step_description); |
| 254 | return step; |
| 255 | } |
| 256 | |
| 257 | void SortingStep::toProto(Protos::SortingStep & proto, bool) const |
| 258 | { |
nothing calls this directly
no test coverage detected