| 117 | String getName() const override { return "Loop"; } |
| 118 | |
| 119 | void initLoop() |
| 120 | { |
| 121 | if (loop) |
| 122 | return; |
| 123 | |
| 124 | QueryPlan plan; |
| 125 | |
| 126 | if (DatabaseCatalog::instance().isTableExist(inner_storage->getStorageID(), context)) |
| 127 | { |
| 128 | inner_context = Context::createCopy(context); |
| 129 | const auto & storage_id = inner_storage->getStorageID(); |
| 130 | buildSelectQueryPlan( |
| 131 | plan, column_names, query_info, inner_context, |
| 132 | storage_id.database_name, storage_id.table_name); |
| 133 | } |
| 134 | else if (inner_table_function_ast) |
| 135 | { |
| 136 | inner_context = Context::createCopy(context); |
| 137 | buildSelectQueryPlan( |
| 138 | plan, column_names, query_info, inner_context, |
| 139 | {}, {}, inner_table_function_ast); |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | const auto metadata_snapshot = inner_storage->getInMemoryMetadataPtr(context, false); |
| 144 | auto inner_storage_snapshot = inner_storage->getStorageSnapshot(metadata_snapshot, context); |
| 145 | inner_storage->read( |
| 146 | plan, |
| 147 | column_names, |
| 148 | inner_storage_snapshot, |
| 149 | query_info, |
| 150 | context, |
| 151 | processed_stage, |
| 152 | max_block_size, |
| 153 | num_streams); |
| 154 | } |
| 155 | |
| 156 | if (plan.isInitialized()) |
| 157 | { |
| 158 | auto builder = plan.buildQueryPipeline(QueryPlanOptimizationSettings(context), BuildQueryPipelineSettings(context)); |
| 159 | QueryPlanResourceHolder resources; |
| 160 | auto pipe = QueryPipelineBuilder::getPipe(std::move(*builder), resources); |
| 161 | query_pipeline = QueryPipeline(std::move(pipe)); |
| 162 | query_pipeline.addResources(std::move(resources)); |
| 163 | executor = std::make_unique<PullingPipelineExecutor>(query_pipeline); |
| 164 | } |
| 165 | loop = true; |
| 166 | } |
| 167 | |
| 168 | Chunk generate() override |
| 169 | { |
nothing calls this directly
no test coverage detected