MCPcopy Create free account
hub / github.com/apache/impala / EstimateSize

Function EstimateSize

be/src/service/query-state-record.cc:164–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164int64_t EstimateSize(const QueryStateRecord* record) {
165 int64_t size = sizeof(QueryStateRecord); // 800
166 size += sizeof(uint8_t) * record->compressed_profile.capacity();
167 size += record->effective_user.capacity();
168 size += record->default_db.capacity();
169 size += record->stmt.capacity();
170 size += record->plan.capacity();
171 size += record->query_state.capacity();
172 size += record->timeline.capacity();
173 size += record->resource_pool.capacity();
174
175 // The following dynamic memory of field members are estimated rather than
176 // exactly sized. Some of thrift members might be nested, but the estimation
177 // does not traverse deeper than the first level.
178
179 // TExecSummary exec_summary
180 if (record->exec_summary.__isset.nodes) {
181 size += sizeof(TPlanNodeExecSummary) * record->exec_summary.nodes.capacity();
182 }
183 if (record->exec_summary.__isset.exch_to_sender_map) {
184 size += sizeof(int32_t) * 2 * record->exec_summary.exch_to_sender_map.size();
185 }
186 if (record->exec_summary.__isset.error_logs) {
187 for (const auto& log : record->exec_summary.error_logs) size += log.capacity();
188 }
189 if (record->exec_summary.__isset.queued_reason) {
190 size += record->exec_summary.queued_reason.capacity();
191 }
192
193 // Status query_status
194 if (!record->query_status.ok()) {
195 size += record->query_status.msg().msg().capacity();
196 for (const auto& detail : record->query_status.msg().details()) {
197 size += detail.capacity();
198 }
199 }
200
201 // TEventSequence event_sequence
202 size += record->event_sequence.name.capacity();
203 size += sizeof(int64_t) * record->event_sequence.timestamps.capacity();
204 for (const auto& label : record->event_sequence.labels) size += label.capacity();
205
206 // vector<TPlanFragment> fragments
207 size += sizeof(TPlanFragment) * record->fragments.capacity();
208
209 return size;
210}
211
212static bool find_instance(RuntimeProfileBase* prof) {
213 return boost::algorithm::istarts_with(prof->name(), "Instance");

Callers 2

ArchiveQueryMethod · 0.85
EstimatedInMemSizeMethod · 0.85

Calls 3

capacityMethod · 0.45
sizeMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected