Skip to content

feat(bindings): getBin + tbox tile emitters#85

Closed
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tile-getters
Closed

feat(bindings): getBin + tbox tile emitters#85
estebanzimanyi wants to merge 1 commit into
mainfrom
feat/parity-tile-getters

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Summary

Adds the scalar tile family that's a counterpart to the bins() / tboxes() table-function work.

  • getBin(value, size, origin) — five overloads (int / bigint / float / date / timestamptz) returning the typed span containing value.
  • valueTiles(tbox, vsize [, vorigin])LIST<TBOX> of value-axis tiles.
  • timeTiles(tbox, duration [, torigin])LIST<TBOX> of time-axis tiles.
  • valueTimeTiles(tbox, vsize, duration [, vorigin, torigin])LIST<TBOX> of cartesian tiles.

The three tbox emitters dispatch on tbox->span.spantype so a single SQL function transparently covers TBOXINT and TBOXFLOAT. Defaults match MobilityDB SQL (vorigin = 0, torigin = '2000-01-03').

Note on a MobilityDB doc bug found while writing this

While verifying expected outputs I noticed the MobilityDB manual's getBin section has two issues — return-type missing for getBin(date, ...), return type wrongly stated as timestamptz (should be tstzspan) for getBin(timestamptz, ...), and the interval '1 week' example output looks wrong ([2001-01-03, 2001-01-10) doesn't match what int_get_bin actually computes, which is [2001-01-01, 2001-01-08)). I have local fixes ready for the doc — will send those upstream separately, not in this PR.

Test plan

  • test/sql/parity/025_temporal_tile_getters.test — 15 assertions covering all five getBin variants, both int and float tbox dispatch in each emitter, and the explicit-torigin override path.
  • No regressions in 001_set.test.

🤖 Generated with Claude Code

…ueTimeTiles)

Adds the single-bin getter family and the LIST<TBOX> emitters that are
the scalar counterparts of the prior bins() / tboxes() table functions.

  getBin(integer, integer, integer)        -> intspan
  getBin(bigint, bigint, bigint)           -> bigintspan
  getBin(double, double, double)           -> floatspan
  getBin(date, interval, date)             -> datespan
  getBin(timestamptz, interval, timestamptz) -> tstzspan

  valueTiles(tbox, vsize [, vorigin])              -> LIST<tbox>
  timeTiles(tbox, duration [, torigin])            -> LIST<tbox>
  valueTimeTiles(tbox, vsize, duration
                  [, vorigin, torigin])            -> LIST<tbox>

The tbox emitters dispatch on tbox->span.spantype so the same SQL
function transparently handles TBOXINT and TBOXFLOAT inputs without
the user having to pick a numeric variant. Defaults match MobilityDB's
SQL: vorigin = 0, torigin = '2000-01-03'.

Test 025_temporal_tile_getters.test exercises all five getBin variants
and the three emitters across both int and float tboxes.

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