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

Method Open

be/src/exec/cardinality-check-node.cc:51–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51Status CardinalityCheckNode::Open(RuntimeState* state) {
52 SCOPED_TIMER(runtime_profile_->total_time_counter());
53 ScopedOpenEventAdder ea(this);
54 RETURN_IF_ERROR(ExecNode::Open(state));
55 RETURN_IF_ERROR(child(0)->Open(state));
56 row_batch_.reset(new RowBatch(row_desc(), 1, mem_tracker()));
57
58 // Read rows from the child, raise error if there are more rows than one
59 RowBatch child_batch(child(0)->row_desc(), state->batch_size(), mem_tracker());
60 bool child_eos = false;
61 int rows_collected = 0;
62 do {
63 RETURN_IF_CANCELLED(state);
64 RETURN_IF_ERROR(QueryMaintenance(state));
65 RETURN_IF_ERROR(child(0)->GetNext(state, &child_batch, &child_eos));
66
67 rows_collected += child_batch.num_rows();
68 if (rows_collected > 1) {
69 return Status(Substitute("Subquery must not return more than one row: $0",
70 display_statement_));
71 }
72 if (child_batch.num_rows() != 0) child_batch.DeepCopyTo(row_batch_.get());
73 child_batch.Reset();
74 } while (!child_eos);
75
76 DCHECK(rows_collected == 0 || rows_collected == 1);
77
78 // If we are inside a subplan we can expect a call to Open()/GetNext()
79 // on the child again.
80 if (!IsInSubplan()) child(0)->Close(state);
81 return Status::OK();
82}
83
84Status CardinalityCheckNode::GetNext(
85 RuntimeState* state, RowBatch* output_row_batch, bool* eos) {

Callers

nothing calls this directly

Calls 13

SubstituteFunction · 0.85
OKFunction · 0.85
total_time_counterMethod · 0.80
batch_sizeMethod · 0.80
DeepCopyToMethod · 0.80
StatusClass · 0.70
resetMethod · 0.65
getMethod · 0.65
row_descMethod · 0.45
GetNextMethod · 0.45
num_rowsMethod · 0.45
ResetMethod · 0.45

Tested by

no test coverage detected