[[arrow::export]]
| 186 | |
| 187 | // [[arrow::export]] |
| 188 | std::shared_ptr<arrow::RecordBatchReader> RecordBatchReader__Head( |
| 189 | const std::shared_ptr<arrow::RecordBatchReader>& reader, int64_t num_rows) { |
| 190 | if (num_rows <= 0) { |
| 191 | // If we are never going to pull any batches from this reader, close it |
| 192 | // immediately. |
| 193 | StopIfNotOk(reader->Close()); |
| 194 | return ValueOrStop(arrow::RecordBatchReader::Make({}, reader->schema())); |
| 195 | } else { |
| 196 | return std::make_shared<RecordBatchReaderHead>(reader, num_rows); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | // Some types of RecordBatchReader input (e.g., DuckDB output) will crash or hang |
| 201 | // if scanned from another thread (e.g., by an ExecPlan). This RecordBatchReader |
no test coverage detected