| 1202 | } |
| 1203 | |
| 1204 | void InterpreterSelectQuery::buildQueryPlan(QueryPlan & query_plan) |
| 1205 | { |
| 1206 | executeImpl(query_plan, std::move(input_pipe)); |
| 1207 | |
| 1208 | /// We must guarantee that result structure is the same as in getSampleBlock() |
| 1209 | if (!blocksHaveEqualStructure(*query_plan.getCurrentHeader(), *result_header)) |
| 1210 | { |
| 1211 | auto convert_actions_dag = ActionsDAG::makeConvertingActions( |
| 1212 | query_plan.getCurrentHeader()->getColumnsWithTypeAndName(), |
| 1213 | result_header->getColumnsWithTypeAndName(), |
| 1214 | ActionsDAG::MatchColumnsMode::Name, |
| 1215 | context, |
| 1216 | true); |
| 1217 | |
| 1218 | auto converting = std::make_unique<ExpressionStep>(query_plan.getCurrentHeader(), std::move(convert_actions_dag)); |
| 1219 | query_plan.addStep(std::move(converting)); |
| 1220 | } |
| 1221 | |
| 1222 | /// Extend lifetime of context, table lock, storage. |
| 1223 | query_plan.addInterpreterContext(context); |
| 1224 | if (table_lock) |
| 1225 | query_plan.addTableLock(std::move(table_lock)); |
| 1226 | if (storage) |
| 1227 | query_plan.addStorageHolder(storage); |
| 1228 | } |
| 1229 | |
| 1230 | BlockIO InterpreterSelectQuery::execute() |
| 1231 | { |
no test coverage detected