I’m trying to read Apache Arrow arrays using the DuckDB C-API from C++ (that is the recommendation, since the C++ API is considered internal to DuckDB), but I can’t seem to get it right. My attempt looks something like this:
duckdb_state state;
duckdb_arrow arrow_result;
duckdb_arrow_array arrow_array;
std::cout << "query:" << std::endl;
state = duckdb_query_arrow(con, "SELECT * FROM test;", &arrow_result);
// check state
state = duckdb_query_arrow_array(arrow_result, &arrow_array);
// check state
However I get a segfault. Even if I got the above working, it’s unclear to me how I would get duck_arrow_array
to ArrowArray
.
I have put together a minimal example using CMake in this repo. To compile, do:
git clone [email protected]:53237d649bad9d3d23159bc23adaee44.git duckdb_capi
cd duckdb_capi
cmake -B build -S .
cmake --build build