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

Method GetNext

be/src/exec/iceberg-delete-node.cc:190–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190Status IcebergDeleteNode::GetNext(RuntimeState* state, RowBatch* out_batch, bool* eos) {
191 SCOPED_TIMER(runtime_profile_->total_time_counter());
192 ScopedGetNextEventAdder ea(this, eos);
193 RETURN_IF_ERROR(ExecDebugAction(TExecNodePhase::GETNEXT, state));
194 DCHECK(!out_batch->AtCapacity());
195
196 Status status = Status::OK();
197 *eos = false;
198 // Save the number of rows in case GetNext() is called with a non-empty batch,
199 // which can happen in a subplan.
200 int num_rows_before = out_batch->num_rows();
201
202 // This loop executes the 'probe_state_' state machine until either a full batch is
203 // produced, resources are attached to 'out_batch' that require flushing, or eos
204 // is reached (i.e. all rows are returned). The next call into GetNext() will resume
205 // execution of the state machine where the current call into GetNext() left off.
206 // See the definition of ProbeState for description of the state machine and states.
207 do {
208 DCHECK(status.ok());
209 RETURN_IF_CANCELLED(state);
210 RETURN_IF_ERROR(QueryMaintenance(state));
211 switch (probe_state_) {
212 case ProbeState::PROBING_IN_BATCH: {
213 // Finish processing rows in the current probe batch.
214 RETURN_IF_ERROR(ProcessProbeBatch(out_batch));
215 if (probe_batch_pos_ == probe_batch_->num_rows()) {
216 probe_state_ = ProbeState::PROBING_END_BATCH;
217 }
218 break;
219 }
220 case ProbeState::PROBING_END_BATCH: {
221 // Try to get the next row batch from the current probe input.
222 bool probe_eos;
223 RETURN_IF_ERROR(NextProbeRowBatch(state, out_batch, &probe_eos));
224 if (probe_batch_pos_ == 0) {
225 // Got a batch, need to process it.
226 probe_state_ = ProbeState::PROBING_IN_BATCH;
227 } else if (probe_eos) {
228 DCHECK_EQ(probe_batch_pos_, -1);
229 // Finished processing all the probe rows
230 RETURN_IF_ERROR(DoneProbing(state, out_batch));
231 probe_state_ = ProbeState::EOS;
232 } else {
233 // Got an empty batch with resources that we need to flush before getting the
234 // next batch.
235 DCHECK_EQ(probe_batch_pos_, -1);
236 }
237 break;
238 }
239 case ProbeState::EOS: {
240 // Ensure that all potential sources of output rows are exhausted.
241 DCHECK(probe_side_eos_);
242 *eos = true;
243 break;
244 }
245 default:
246 DCHECK(false) << "invalid probe_state_" << static_cast<int>(probe_state_);
247 break;

Callers 1

Calls 7

OKFunction · 0.85
total_time_counterMethod · 0.80
set_num_rowsMethod · 0.80
AtCapacityMethod · 0.45
num_rowsMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected