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

Method ReadNext

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

Source from the content-addressed store, hash-verified

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