Generate the npoint network-point family (cbuffer twin) - #225
Closed
estebanzimanyi wants to merge 2 commits into
Closed
Generate the npoint network-point family (cbuffer twin)#225estebanzimanyi wants to merge 2 commits into
estebanzimanyi wants to merge 2 commits into
Conversation
…ical Regenerates the generated UDF surface from MobilityDB master (which brings in the generic temporal_hash surface). The MEOS-API catalog now renders the uint32 canonical type as `unsigned int` (it was `uint32_t`); key the scalar type maps on it so the *_hash functions keep registering instead of being dropped. uint32 hashes map to DuckDB's native `UINTEGER`, not a signed `INTEGER` — a hash >= 2**31 is out of range for INT32 and DuckDB range-checks the cast rather than bit-reinterpreting the way PostgreSQL/C do; DuckDB has real unsigned SQL types, so `UINTEGER` is the faithful representation.
Add the network-point temporal family (npoint / nsegment / tnpoint) to the
MobilityDuck generated surface as the 2D-planar twin of cbuffer. Both inherit
Spatial<T> and are non-geodetic; the only difference is that npoint carries no
SRID or geometry of its own — a route identifier is resolved against a fixed
`ways` network (Npoint(1,0.5) vs Cbuffer(Point(1 1),1)).
- src/npoint/tnpoint.{cpp,hpp}: the npoint/nsegment/tnpoint BLOB types, their
text <-> VARCHAR casts, and fixed-struct marshalling. Npoint and Nsegment are
palloc(sizeof) structs (not varlena), so they copy in/out by sizeof like
Span/STBox rather than by VARSIZE.
- tools/codegen_duck_udfs.py: wire Npoint/Nsegment into the base-value
marshalling maps and tnpoint into the Spatial<T> type set, so the whole
inherited Spatial<T> + Temporal<T> surface (205 registrations) is generated.
- Ship the canonical example `ways` network embedded (src/ways_csv.inc) and
point MEOS at it once at load (ConfigureMeosWaysCsvOnce), mirroring the
spatial_ref_sys CSV wiring, so route SRID and geometry resolve.
- test/sql/tnpoint.test: type/text I/O, accessors, the network-inherited SRID
(5676) and position interpolation, and the inherited bbox operators.
estebanzimanyi
force-pushed
the
feat/duck-npoint-family
branch
from
July 22, 2026 19:41
3576740 to
26f1991
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds the network-point temporal family (
npoint/nsegment/tnpoint) to the generated MobilityDuck surface as the 2D-planar twin ofcbuffer.npoint and cbuffer are twin families —
Npoint(1,0.5)vsCbuffer(Point(1 1),1). Both inheritSpatial<T>and are non-geodetic; the only difference is that npoint carries no SRID or geometry of its own — a route identifier is resolved against a fixedwaysnetwork.src/npoint/tnpoint.{cpp,hpp}: thenpoint/nsegment/tnpointtypes, their text ↔ VARCHAR casts, and fixed-struct marshalling.NpointandNsegmentare fixed structs (palloc(sizeof)), so they copy in/out bysizeoflikeSpan/STBoxrather than byVARSIZE.Npoint/Nsegmentinto the base-value marshalling maps andtnpointinto theSpatial<T>type set, so the whole inheritedSpatial<T>+Temporal<T>surface (205 registrations) is generated — no hand-written UDFs.waysnetwork embedded (src/ways_csv.inc) and points MEOS at it once at load (ConfigureMeosWaysCsvOnce), mirroring thespatial_ref_sysCSV wiring, so route SRID and geometry resolve.test/sql/tnpoint.test: type/text I/O, accessors, the network-inherited SRID (5676) and position interpolation, and the inherited bbox operators.