refactor: Reuse GeoArrowArrayReader in ReaderImpl #29
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I am not entirely sure this is desired (it gives a bit of overhead), but while trying to understand the reader/writer/builder/visitor hierarchy in geoarrow-c, I noticed that here we were not using
GeoArrowArrayReader
, but the separate readers for WKT/WKB (GeoArrowWKTReader
/GeoArrowWKBReader
) andGeoArrowArrayViewVisit
for native coords, duplicating the iteration function for WKT/WKB.While the
GeoArrowArrayReader
already abstracts away those three options behind a single interface.This gives a bit more overhead for the scalar
WKTReader
(I assume because this constructs ageoarrow::Reader
every time, and this now not just initializes theGeoArrowWKTReader
, but also the other structs for WKB and native).Given this is the scalar version (and you can always ensure to start from arrow input for optimal performance), I think that overhead is acceptable. But alternatively, we could also update
GeoArrowArrayReader
to only initialize the WKT/WKB readers if needed (when it gets data passed with that type), instead of upfront. Or another option is to expose theGeoArrowArrayViewVisitWKT/WKB
functions in geoarrow.h, so that we can at least avoid reimplementing those.Also added some brief doc comments.