| 89 | } |
| 90 | |
| 91 | void SourceFromInputStream::work() |
| 92 | { |
| 93 | if (!is_generating_finished) |
| 94 | { |
| 95 | try |
| 96 | { |
| 97 | ISource::work(); |
| 98 | } |
| 99 | catch (...) |
| 100 | { |
| 101 | /// Won't read suffix in case of exception. |
| 102 | is_stream_finished = true; |
| 103 | throw; |
| 104 | } |
| 105 | |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | if (is_stream_finished) |
| 110 | return; |
| 111 | |
| 112 | /// Don't cancel for RemoteBlockInputStream (otherwise readSuffix can stack) |
| 113 | if (!typeid_cast<const RemoteBlockInputStream *>(stream.get())) |
| 114 | stream->cancel(false); |
| 115 | |
| 116 | if (rows_before_limit) |
| 117 | { |
| 118 | const auto & info = stream->getProfileInfo(); |
| 119 | if (info.hasAppliedLimit()) |
| 120 | rows_before_limit->add(info.getRowsBeforeLimit()); |
| 121 | } |
| 122 | |
| 123 | stream->readSuffix(); |
| 124 | |
| 125 | if (auto totals_block = stream->getTotals()) |
| 126 | { |
| 127 | totals.setColumns(totals_block.getColumns(), 1); |
| 128 | has_totals = true; |
| 129 | } |
| 130 | |
| 131 | is_stream_finished = true; |
| 132 | } |
| 133 | |
| 134 | Chunk SourceFromInputStream::generate() |
| 135 | { |
nothing calls this directly
no test coverage detected