Closed brendan-ward closed 1 month ago
Yeah, ogr_open_arrow
itself uses yield
to return the stream, so that can be consumed before the finally
block inside ogr_open_arrow
is run. So we would need to do the same here, but not sure you can do yield twice in a chain. But indeed, could also move the virtual file cleanup into ogr_open_arrow
, and all yield / cleanup logic is handled at that level.
When reading from a file-like, we first extract out the bytes and set them into a VSI memory file, and then clean that up after reading the datasource. When reading from Arrow using read_arrow (ultimately affects open_arrow), we inadvertently cleanup the memory file before actually reading from it because we do the following in
open_arrow
:The
finally
block gets called beforeogr_open_arrow
has read from the memory file.The cleanest fix is likely to move all handling of the memory file to
ogr_open_arrow
, and let it cleanup the memory file in its finally block.