Hi,
I noticed that my previous code worked only for one ArrowArray from DuckDB. I
change a code this but this is still working only for one ArrowArray. The
second “loop” causes a segmentation fault. Could someone guide me a bit? What
should I change to get this work?
ArrowSchema *arrow_schema = new ArrowSchema();
duckdb_query_arrow_schema(arrow_result, (duckdb_arrow_schema *)&arrow_schema);
auto schema = arrow::ImportSchema(arrow_schema);
auto output_stream = arrow::io::BufferOutputStream::Create();
auto batch_writer = arrow::ipc::MakeStreamWriter(*output_stream, *schema);
while (true) {
ArrowArray *arrow_array = new ArrowArray();
duckdb_query_arrow_array(arrow_result, (duckdb_arrow_array *)&arrow_array);
if( arrow_array->length > 0) {
(*batch_writer)->WriteRecordBatch((const arrow::RecordBatch&)
**arrow::ImportRecordBatch(arrow_array,*schema));
delete arrow_array;
}else{
break;
}
}
auto buffer = (*output_stream)->Finish();
Best regards,
Kimmo
--
Kimmo Linna
Nihtisalontie 3 as 1
02630 ESPOO
[email protected]
+358 40 590 1074