| 131 | } |
| 132 | |
| 133 | void executeSubQuery(const String & query, ContextMutablePtr query_context, std::function<void(Block &)> proc_block, bool internal) |
| 134 | { |
| 135 | modifyQueryContext(query_context, internal); |
| 136 | |
| 137 | std::exception_ptr exception; |
| 138 | auto thread = ThreadFromGlobalPool([query_context = std::move(query_context), &query, proc_block, internal, &exception]() { |
| 139 | try |
| 140 | { |
| 141 | CurrentThread::QueryScope query_scope{query_context}; |
| 142 | { |
| 143 | auto block_io = executeQuery(query, query_context, internal); |
| 144 | |
| 145 | auto input_stream = block_io.getInputStream(); |
| 146 | input_stream->readPrefix(); |
| 147 | while (auto block = input_stream->read()) |
| 148 | { |
| 149 | if (block.rows() == 0) |
| 150 | continue; |
| 151 | proc_block(block); |
| 152 | } |
| 153 | input_stream->readSuffix(); |
| 154 | |
| 155 | block_io.onFinish(); |
| 156 | } |
| 157 | } |
| 158 | catch (...) |
| 159 | { |
| 160 | exception = constructException(query_context); |
| 161 | } |
| 162 | }); |
| 163 | thread.join(); |
| 164 | |
| 165 | if (exception) |
| 166 | std::rethrow_exception(exception); |
| 167 | } |
| 168 | |
| 169 | Block executeSubPipelineWithOneRow( |
| 170 | const ASTPtr & query, ContextMutablePtr query_context, std::function<void(InterpreterSelectQueryUseOptimizer &)> pre_execute, bool tolerate_multi_rows) |
no test coverage detected