apache / apache/sedona-db

Optimize ST_AsGeoJSON using `encode_geometry()`

Open
#472 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.