Skip to content

Generate the npoint network-point family (cbuffer twin) - #225

Closed
estebanzimanyi wants to merge 2 commits into
mainfrom
feat/duck-npoint-family
Closed

Generate the npoint network-point family (cbuffer twin)#225
estebanzimanyi wants to merge 2 commits into
mainfrom
feat/duck-npoint-family

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Adds the network-point temporal family (npoint / nsegment / tnpoint) to the generated MobilityDuck surface as the 2D-planar twin of cbuffer.

npoint and cbuffer are twin families — Npoint(1,0.5) vs Cbuffer(Point(1 1),1). 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.

  • src/npoint/tnpoint.{cpp,hpp}: the npoint/nsegment/tnpoint types, their text ↔ VARCHAR casts, and fixed-struct marshalling. Npoint and Nsegment are fixed structs (palloc(sizeof)), so they copy in/out by sizeof like Span/STBox rather than by VARSIZE.
  • Generator: wires 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 — no hand-written UDFs.
  • Ships the canonical example ways network embedded (src/ways_csv.inc) and points 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.

nhungoc1508 and others added 2 commits July 22, 2026 21:40
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants