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

Method Init

be/src/runtime/coordinator.cc:291–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void Coordinator::ExecSummary::Init(const QueryExecParams& exec_params) {
292 const TQueryExecRequest& request = exec_params.query_exec_request();
293 // init exec_summary_.{nodes, exch_to_sender_map}
294 thrift_exec_summary.__isset.nodes = true;
295 DCHECK(thrift_exec_summary.nodes.empty());
296 for (const TPlanExecInfo& plan_exec_info: request.plan_exec_info) {
297 for (const TPlanFragment& fragment: plan_exec_info.fragments) {
298 if (!fragment.__isset.plan) continue;
299
300 // eventual index of fragment's root node in exec_summary_.nodes
301 int root_node_idx = thrift_exec_summary.nodes.size();
302
303 const TPlan& plan = fragment.plan;
304 const TDataSink& output_sink = fragment.output_sink;
305 // Count the number of hosts and instances.
306 const FragmentExecParamsPB& fragment_exec_param =
307 exec_params.query_schedule().fragment_exec_params(fragment.idx);
308 int num_hosts = fragment_exec_param.num_hosts();
309 int num_instances = fragment_exec_param.instances_size();
310
311 // Add the data sink at the root of the fragment.
312 data_sink_id_to_idx_map[fragment.idx] = thrift_exec_summary.nodes.size();
313 thrift_exec_summary.nodes.emplace_back();
314 // Note that some clients like impala-shell depend on many of these fields being
315 // set, even if they are optional in the thrift.
316 TPlanNodeExecSummary& node_summary = thrift_exec_summary.nodes.back();
317 node_summary.__set_node_id(SINK_NODE_ID);
318 node_summary.__set_fragment_idx(fragment.idx);
319 node_summary.__set_label(output_sink.label);
320 node_summary.__set_label_detail(output_sink.label_detail);
321 node_summary.__set_num_children(1);
322 DCHECK(output_sink.__isset.estimated_stats);
323 node_summary.__set_estimated_stats(output_sink.estimated_stats);
324 node_summary.__set_num_hosts(num_hosts);
325 node_summary.exec_stats.resize(num_instances);
326
327 // We don't track rows returned from sinks, but some clients like impala-shell
328 // expect it to be set in the thrift struct. Set it to -1 for compatibility
329 // with those tools.
330 node_summary.estimated_stats.__set_cardinality(-1);
331 for (TExecStats& instance_stats : node_summary.exec_stats) {
332 instance_stats.__set_cardinality(-1);
333 }
334
335 for (const TPlanNode& node : plan.nodes) {
336 node_id_to_idx_map[node.node_id] = thrift_exec_summary.nodes.size();
337 thrift_exec_summary.nodes.emplace_back();
338 TPlanNodeExecSummary& node_summary = thrift_exec_summary.nodes.back();
339 node_summary.__set_node_id(node.node_id);
340 node_summary.__set_fragment_idx(fragment.idx);
341 node_summary.__set_label(node.label);
342 node_summary.__set_label_detail(node.label_detail);
343 node_summary.__set_num_children(node.num_children);
344 DCHECK(node.__isset.estimated_stats);
345 node_summary.__set_estimated_stats(node.estimated_stats);
346 node_summary.__set_num_hosts(num_hosts);
347 node_summary.exec_stats.resize(num_instances);
348 }

Callers 2

ExecMethod · 0.45
InitBackendStatesMethod · 0.45

Calls 4

IsJoinBuildSinkFunction · 0.85
resizeMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected