A stage fragment is shipped to workers by serializing its query plan, so every step must support serialization. Check up front (without serializing) so an unsupported plan fails early with a clear message instead of late, mid-execution, with a generic error.
| 53 | /// serialization. Check up front (without serializing) so an unsupported plan fails early with a clear |
| 54 | /// message instead of late, mid-execution, with a generic error. |
| 55 | void assertFragmentSerializable(const QueryPlan & fragment, const String & stage_name) |
| 56 | { |
| 57 | std::vector<const QueryPlan::Node *> stack; |
| 58 | if (fragment.getRootNode()) |
| 59 | stack.push_back(fragment.getRootNode()); |
| 60 | while (!stack.empty()) |
| 61 | { |
| 62 | const auto * node = stack.back(); |
| 63 | stack.pop_back(); |
| 64 | if (node->step && !node->step->isSerializable()) |
| 65 | throw Exception(ErrorCodes::SUPPORT_IS_DISABLED, |
| 66 | "make_distributed_plan cannot distribute this query: step '{}' in stage '{}' is not " |
| 67 | "serializable for remote execution", node->step->getName(), stage_name); |
| 68 | for (const auto * child : node->children) |
| 69 | stack.push_back(child); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | } |
| 74 |
no test coverage detected