Optimize ST_AsGeoJSON using `encode_geometry()`
- Dominant language
- Rust
- Stars
- 503
- Forks
- 61
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 91
Description
We can do this in a follow-up PR and not this one; however, this chain of WKB bytes -> Wkb object -> GeoTypes geometry -> GeoJSON geometry is probably very slow. If we can use:
https://github.com/geoarrow/geoarrow-rs/blob/e17e9e48a6e1b357d5c71839dd33c7cb72d853c0/rust/geoarrow-geojson/src/encoder/geometry.rs#L31-L48
(which should operate directly on a `Wkb` object), then I think we might be able to make this quite a bit faster (and support Z values).
_Originally posted by @paleolimbot in https://github.com/apache/sedona-db/pull/469#discussion_r2650157091_
Contributor guide
Research direction
Start at the ST_AsGeoJSON implementation and inspect the linked geoarrow-rs encoder/geometry.rs implementation. Trace the current WKB -> Wkb -> GeoTypes -> GeoJSON path, then verify whether using encode_geometry() avoids those conversions and supports Z values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100