| 1065 | } |
| 1066 | |
| 1067 | Status Close() override { |
| 1068 | if (!iterator_) { |
| 1069 | // Already closed |
| 1070 | return Status::OK(); |
| 1071 | } |
| 1072 | // End plan and read from generator until finished |
| 1073 | plan_->StopProducing(); |
| 1074 | std::shared_ptr<RecordBatch> batch; |
| 1075 | do { |
| 1076 | Status st = ReadNext(&batch); |
| 1077 | if (!st.ok()) { |
| 1078 | if (st.IsCancelled()) break; // plan cancelled, so closing is done |
| 1079 | return st; |
| 1080 | } |
| 1081 | } while (batch != nullptr); |
| 1082 | iterator_.reset(); |
| 1083 | return Status::OK(); |
| 1084 | } |
| 1085 | |
| 1086 | std::shared_ptr<ExecPlan> plan_; |
| 1087 | std::shared_ptr<Schema> schema_; |
nothing calls this directly
no test coverage detected