-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
This PR introduced a new WkbBytesExecutor that was used to optimize the implementation of st_geometrytype. It allowed us to extract what we needed without parsing the entire buffer, saving a lot of time. I had the bright idea of leveraging this for the dimension calculation, so we can implement functions like st_hasz and st_hasm without parsing the entire geometry. The logic turns out to be more complicated than I originally expected (due to edge cases relating to inferring the dimensionality), but I still think this is doable.
To properly get the dimensionality, we need to OR all of the following (short circuiting permitted of course):
- the dimensionality of the geometry type (the obvious one)
- e.g
POINT Z EMPTY
- e.g
- the dimensionality of the first nested geometry (if it's some sort of collection)
- e.g
GEOMETRYCOLLECTION (POINT Z (0 0 0))-> xyz
- e.g
the dimensionality of the first coordinate(in WKB this is actually represented as the dimensionality of the nested geometry object, not the first coordinate)e.gPOINT (0 0 0)-> xyz,POINT (0 0 0 0)-> xyzm
All of those examples are (apparently) valid.
Metadata
Metadata
Assignees
Labels
No labels