| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/common/arrow/result_arrow_wrapper.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/main/query_result.hpp" |
| 12 | #include "duckdb/common/arrow/arrow_wrapper.hpp" |
| 13 | |
| 14 | namespace duckdb { |
| 15 | class ResultArrowArrayStreamWrapper { |
| 16 | public: |
| 17 | explicit ResultArrowArrayStreamWrapper(unique_ptr<QueryResult> result, idx_t batch_size); |
| 18 | ArrowArrayStream stream; |
| 19 | unique_ptr<QueryResult> result; |
| 20 | PreservedError last_error; |
| 21 | idx_t batch_size; |
| 22 | vector<LogicalType> column_types; |
| 23 | vector<string> column_names; |
| 24 | |
| 25 | private: |
| 26 | static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out); |
| 27 | static int MyStreamGetNext(struct ArrowArrayStream *stream, struct ArrowArray *out); |
| 28 | static void MyStreamRelease(struct ArrowArrayStream *stream); |
| 29 | static const char *MyStreamGetLastError(struct ArrowArrayStream *stream); |
| 30 | }; |
| 31 | } // namespace duckdb |
| 32 |