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

Method tryGenerate

src/Processors/Sources/RemoteSource.cpp:70–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70std::optional<Chunk> RemoteSource::tryGenerate()
71{
72 /// onCancel() will do the cancel if the query was sent.
73 if (was_query_canceled)
74 return {};
75
76 if (!was_query_sent)
77 {
78 /// Progress method will be called on Progress packet.
79 query_executor->setProgressCallback([this](const Progress & value) { progress(value); });
80
81 /// Get rows_before_limit result for remote query from ProfileInfo packet.
82 query_executor->setProfileInfoCallback([this](const BlockStreamProfileInfo & info)
83 {
84 if (rows_before_limit && info.hasAppliedLimit())
85 rows_before_limit->set(info.getRowsBeforeLimit());
86 });
87
88 query_executor->sendQuery();
89
90 was_query_sent = true;
91 }
92
93 Block block;
94
95 if (async_read)
96 {
97 auto res = query_executor->read(read_context);
98 if (std::holds_alternative<int>(res))
99 {
100 fd = std::get<int>(res);
101 is_async_state = true;
102 return Chunk();
103 }
104
105 is_async_state = false;
106
107 block = std::get<Block>(std::move(res));
108 }
109 else
110 block = query_executor->read();
111
112 if (!block)
113 {
114 query_executor->finish(&read_context);
115 return {};
116 }
117
118 UInt64 num_rows = block.rows();
119 Chunk chunk(block.getColumns(), num_rows);
120
121 if (add_aggregation_info)
122 {
123 auto info = std::make_shared<AggregatedChunkInfo>();
124 info->bucket_num = block.info.bucket_num;
125 info->is_overflows = block.info.is_overflows;
126 chunk.setChunkInfo(std::move(info));
127 }

Callers

nothing calls this directly

Calls 12

getRowsBeforeLimitMethod · 0.80
setChunkInfoMethod · 0.80
ChunkClass · 0.50
setProgressCallbackMethod · 0.45
hasAppliedLimitMethod · 0.45
setMethod · 0.45
sendQueryMethod · 0.45
readMethod · 0.45
finishMethod · 0.45
rowsMethod · 0.45
getColumnsMethod · 0.45

Tested by

no test coverage detected