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

Method Exec

be/src/runtime/fragment-instance-state.cc:94–153  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 instance_ctx_pb_(instance_ctx_pb) {}
93
94Status FragmentInstanceState::Exec() {
95 bool is_prepared = false;
96 Status status = Prepare();
97 DCHECK(runtime_state_ != nullptr); // we need to guarantee at least that
98
99 if (!status.ok()) {
100 discard_result(opened_promise_.Set(status));
101 goto done;
102 }
103 // Tell the managing 'QueryState' that we're done with Prepare().
104 query_state_->DonePreparing();
105 is_prepared = true;
106
107 status = Open();
108 discard_result(opened_promise_.Set(status));
109 if (!status.ok()) goto done;
110
111 {
112 // Must go out of scope before Finalize(), otherwise counter will not be
113 // updated by time final profile is sent.
114 SCOPED_TIMER2(profile()->total_time_counter(),
115 ADD_TIMER(timings_profile_, EXEC_TIMER_NAME));
116 status = ExecInternal();
117 }
118
119done:
120 // Don't transition to completion until Close() is called as some new errors may be
121 // logged in RuntimeState:error_log_.
122 Close();
123
124 DCHECK_EQ(is_prepared,
125 current_state_.Load() > FInstanceExecStatePB::WAITING_FOR_PREPARE);
126
127 if (!status.ok()) {
128 exec_failed_.Store(true);
129 if (!is_prepared) {
130 UpdateState(StateEvent::EXEC_END);
131
132 // Tell the managing 'QueryState' that we hit an error during Prepare().
133 query_state_->ErrorDuringPrepare(status, instance_id());
134 } else {
135 // Must set exec_failed_ first, then update the 'Query State' before updating the
136 // fragment instance state. Otherwise, there is a race when reading the 'done' flag
137 // with GetStatusReport(). This may lead to report the instance as "completed"
138 // without error, or the "final" profile being sent with the 'done' flag as false.
139
140 // Tell the managing 'QueryState' that we hit an error during execution.
141 query_state_->ErrorDuringExecute(status, instance_id());
142
143 UpdateState(StateEvent::EXEC_END);
144 query_state_->DoneRemainingExecuting();
145 }
146 } else {
147 UpdateState(StateEvent::EXEC_END);
148
149 // Tell the managing 'QueryState' that we're done with executing.
150 query_state_->DoneExecuting();
151 }

Callers

nothing calls this directly

Calls 11

discard_resultFunction · 0.85
DonePreparingMethod · 0.80
total_time_counterMethod · 0.80
ErrorDuringPrepareMethod · 0.80
ErrorDuringExecuteMethod · 0.80
DoneExecutingMethod · 0.80
okMethod · 0.45
SetMethod · 0.45
LoadMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected