Skip to content

feat(bindings): single-tile getters (tbox + stbox)#88

Closed
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-single-tile-getters
Closed

feat(bindings): single-tile getters (tbox + stbox)#88
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-single-tile-getters

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Adds the per-input lookup form of the tile family — given a single point in the (value, time, space) domain and a tile-grid configuration, return the one tile that contains it. These complement the previously-shipped LIST emitters (valueTiles/timeTiles/valueTimeTiles/spaceTiles/...).

Function Signature Returns
getValueTile double, double [, double=0.0] tbox
getTBoxTimeTile timestamptz, interval [, timestamptz='2000-01-03'] tbox
getValueTimeTile double, timestamptz, double, interval [, double=0.0, timestamptz='2000-01-03'] tbox
getSpaceTile geom, xsize (uniform xyz) or geom, xsize, ysize, zsize [, sorigin] stbox
getStboxTimeTile timestamptz, interval [, timestamptz='2000-01-03'] stbox
getSpaceTimeTile geom, t, xsize, ysize, zsize, interval [, sorigin, torigin] stbox

11 overloads in total.

Implementation notes

  • Temporal variants funnel through MEOS internal tbox_get_value_time_tile (declared in meos_internal.h). The basetype/spantype hint mirrors how the MobilityDB PG layer derives them from the first SQL arg: T_FLOAT8/T_FLOATSPAN for value-bearing variants, T_TIMESTAMPTZ/T_TSTZSPAN for the time-only getter. This detail matters — passing T_FLOAT8 for the time-only path makes MEOS raise Span cannot be empty.
  • Spatial variants call stbox_get_space_tile / stbox_get_time_tile / stbox_get_space_time_tile directly. Default sorigin = Point(0 0 0) is built once and cached.

Test plan

  • test/sql/parity/026_single_tile_getters.test — 10 assertions covering every shape (no-origin, explicit-origin, uniform-xyz convenience).
  • No regression in any other parity test.

🤖 Generated with Claude Code

…tValueTimeTile + spatial

Adds the per-input lookup form of the tile family as a counterpart to
the LIST<TBOX>/LIST<STBOX> emitters previously shipped as
valueTiles / timeTiles / valueTimeTiles / spaceTiles / etc.

Temporal (3 names, 5 overloads):
  getValueTile(double, double [, double=0.0])           -> tbox
  getTBoxTimeTile(timestamptz, interval
                  [, timestamptz='2000-01-03'])         -> tbox
  getValueTimeTile(double, timestamptz, double, interval
                  [, double=0.0, timestamptz='2000-01-03']) -> tbox

Spatial (3 names, 6 overloads):
  getSpaceTile(geom, xsize)                             -> stbox  (uniform xyz)
  getSpaceTile(geom, xsize, ysize, zsize [, sorigin])   -> stbox
  getStboxTimeTile(timestamptz, interval
                  [, timestamptz='2000-01-03'])         -> stbox
  getSpaceTimeTile(geom, t, xsize, ysize, zsize, interval
                  [, sorigin, torigin])                 -> stbox

All temporal variants funnel through the MEOS internal
`tbox_get_value_time_tile`. The basetype/spantype hint to MEOS comes
from the first argument: T_FLOAT8/T_FLOATSPAN for value-bearing
variants, T_TIMESTAMPTZ/T_TSTZSPAN for the time-only getter (this
detail is what mirrors how the MobilityDB PG layer derives the basetype
from the first SQL arg in `Tbox_get_value_time_tile_common`).

Spatial variants call `stbox_get_space_tile` / `stbox_get_time_tile` /
`stbox_get_space_time_tile` directly with a default-cached
`Point(0 0 0)` GSERIALIZED used when no explicit sorigin is supplied.

Test 026_single_tile_getters.test exercises every shape (10 assertions).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@estebanzimanyi
Copy link
Copy Markdown
Member Author

Superseded by the consolidated PR branch consolidate/tiles-bins-parity. All changes from this PR are included in that branch as a single squashed commit. Please review and merge the consolidated branch instead.

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.

1 participant