MCPcopy Create free account
hub / github.com/apache/arrow / ReadNext

Method ReadNext

r/src/compute-exec.cpp:106–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 std::shared_ptr<arrow::Schema> schema() const override { return schema_; }
105
106 arrow::Status ReadNext(std::shared_ptr<arrow::RecordBatch>* batch_out) override {
107 // If this is the first batch getting pulled, tell the exec plan to
108 // start producing
109 if (plan_status_ == PLAN_NOT_STARTED) {
110 StartProducing();
111 }
112
113 // If we've closed the reader, keep sending nullptr
114 // (consistent with what most RecordBatchReader subclasses do)
115 if (plan_status_ == PLAN_FINISHED) {
116 batch_out->reset();
117 return arrow::Status::OK();
118 }
119
120 // Check for cancellation and stop the plan if we have a request. When
121 // the ExecPlan supports passing a StopToken and handling this itself,
122 // this will be redundant.
123 if (stop_token_.IsStopRequested()) {
124 StopProducing();
125 return stop_token_.Poll();
126 }
127
128 auto out = sink_gen_().result();
129 if (!out.ok()) {
130 StopProducing();
131 return out.status();
132 }
133
134 if (out.ValueUnsafe()) {
135 auto batch_result = out.ValueUnsafe()->ToRecordBatch(schema_, gc_memory_pool());
136 if (!batch_result.ok()) {
137 StopProducing();
138 return batch_result.status();
139 }
140
141 *batch_out = batch_result.ValueUnsafe();
142 } else {
143 batch_out->reset();
144 plan_status_ = PLAN_FINISHED;
145 return plan_->finished().status();
146 }
147
148 return arrow::Status::OK();
149 }
150
151 arrow::Status Close() override {
152 StopProducing();

Callers

nothing calls this directly

Calls 11

gc_memory_poolFunction · 0.85
IsStopRequestedMethod · 0.80
PollMethod · 0.80
ValueUnsafeMethod · 0.80
ToRecordBatchMethod · 0.80
finishedMethod · 0.80
OKFunction · 0.50
resetMethod · 0.45
resultMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected