MCPcopy Create free account
hub / github.com/ByConity/ByConity / generate

Method generate

src/Processors/Sources/SourceFromInputStream.cpp:134–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134Chunk SourceFromInputStream::generate()
135{
136 if (is_stream_finished)
137 return {};
138
139 if (!is_stream_started)
140 {
141 stream->readPrefix();
142 is_stream_started = true;
143 }
144
145 auto block = stream->read();
146 if (!block && !isCancelled())
147 {
148 if (rows_before_limit)
149 {
150 const auto & info = stream->getProfileInfo();
151 if (info.hasAppliedLimit())
152 rows_before_limit->add(info.getRowsBeforeLimit());
153 }
154
155 stream->readSuffix();
156
157 if (auto totals_block = stream->getTotals())
158 {
159 if (totals_block.rows() > 0) /// Sometimes we can get empty totals. Skip it.
160 {
161 totals.setColumns(totals_block.getColumns(), totals_block.rows());
162 has_totals = true;
163 }
164 }
165
166 if (auto extremes_block = stream->getExtremes())
167 {
168 if (extremes_block.rows() > 0) /// Sometimes we can get empty extremes. Skip it.
169 {
170 extremes.setColumns(extremes_block.getColumns(), extremes_block.rows());
171 has_extremes = true;
172 }
173 }
174
175 is_stream_finished = true;
176 return {};
177 }
178
179 if (isCancelled())
180 return {};
181
182#ifndef NDEBUG
183 assertBlocksHaveEqualStructure(getPort().getHeader(), block, "SourceFromInputStream");
184#endif
185
186 UInt64 num_rows = block.rows();
187 Chunk chunk(block.getColumns(), num_rows);
188
189 if (force_add_aggregating_info || has_aggregate_functions)
190 {
191 auto info = std::make_shared<AggregatedChunkInfo>();

Callers

nothing calls this directly

Calls 15

isCancelledFunction · 0.85
getRowsBeforeLimitMethod · 0.80
setChunkInfoMethod · 0.80
readPrefixMethod · 0.45
readMethod · 0.45
hasAppliedLimitMethod · 0.45
addMethod · 0.45
readSuffixMethod · 0.45
getTotalsMethod · 0.45
rowsMethod · 0.45
setColumnsMethod · 0.45

Tested by

no test coverage detected