Skip to content

feat(bindings): valueSplit / timeSplit / valueTimeSplit TableFunctions#81

Closed
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-temporal-tile-tablefunctions
Closed

feat(bindings): valueSplit / timeSplit / valueTimeSplit TableFunctions#81
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-temporal-tile-tablefunctions

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Closes the TableFunction-deferred portion of `temporal/025_temporal_tile`. Set-returning splitters that bucket a temporal into one row per (value[, time]) bin.

New SQL surface (16 TableFunction overloads)

Signature Returns
`valueSplit(tint, integer[, integer])` `TABLE(value bigint, tint tint)`
`valueSplit(tfloat, double[, double])` `TABLE(value double, tfloat tfloat)`
`timeSplit(, interval[, timestamptz])` `TABLE(time timestamptz, )` (4 base types × 2 origin variants)
`valueTimeSplit(tint, integer, interval[, integer[, timestamptz]])` `TABLE(value bigint, time timestamptz, tint tint)`
`valueTimeSplit(tfloat, double, interval[, double[, timestamptz]])` `TABLE(value double, time timestamptz, tfloat tfloat)`

Implementation

Mirrors PR #79's spaceSplit/spaceTimeSplit pattern:

  • `TileBindData` captures the input temporal blob, scalar tile parameters, and a `TileKind` discriminator (`ValueSplit` / `TimeSplit` / `ValueTimeSplit`).
  • `TileInit` calls the matching MEOS export (`tint_value_split` / `tfloat_value_split` / `temporal_time_split` / `tint_value_time_split` / `tfloat_value_time_split`) and buffers the parallel output arrays as Value triples.
  • `TileExec` drains the buffer; the cardinality-2 vs cardinality-3 output decision lives at register-time via separate Bind functions but a shared Init/Exec.

Hooked into `LoadInternal` via a new `RegisterTemporalTileSplit` method on `TemporalTypes`, kept distinct from the scalar registrations and the existing `tempUnnest` TableFunction.

Tests

  • `test/sql/parity/025_temporal_tile_split.test` — 12 query cases covering all three function names on each supported base type, default-origin and explicit-origin variants, and a 3-column shape check on `valueTimeSplit` output.
  • Full suite: 772 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

  • `temporal/025_temporal_tile` now closes valueSplit / timeSplit / valueTimeSplit. Remaining names in this section: `bins`, `getBin`, `getValueTile`, `getTBoxTimeTile`, `getValueTimeTile`, `timeBins`, `timeBoxes`, `timeTiles`, `valueBins`, `valueBoxes`, `valueTiles`, `valueTimeBoxes`, `valueTimeTiles` — these are LIST(span/tbox)-returning scalar emitters; separate follow-up.

Test plan

  • `cmake --build . --target shell unittest` clean
  • New parity test passes (20 assertions / 1 case)
  • Full suite green (772/14)

Closes the TableFunction-deferred portion of temporal/025_temporal_tile.
Set-returning splitters that bucket a temporal into one row per
(value[, time]) bin, mirroring MobilityDB's

  valueSplit(tnumber, vsize[, vorigin])
    RETURNS TABLE(value <bigint|double>, <tnumber>)

  timeSplit(temporal, duration[, torigin])
    RETURNS TABLE(time timestamptz, <temporal>)

  valueTimeSplit(tnumber, vsize, duration[, vorigin[, torigin]])
    RETURNS TABLE(value <bigint|double>, time timestamptz, <tnumber>)

Implementation pattern mirrors PR #79's spaceSplit / spaceTimeSplit:

- TileBindData captures the input temporal blob, scalar tile parameters,
  and a TileKind discriminator (ValueSplit / TimeSplit / ValueTimeSplit).
- TileInit calls the matching MEOS export
  (tint_value_split / tfloat_value_split / temporal_time_split /
  tint_value_time_split / tfloat_value_time_split) and buffers the
  parallel output arrays as Value triples.
- TileExec drains the buffer, switching on TileKind to set the right
  set of output columns.

Registered TableFunction overloads (16 total):

- valueSplit on tint and tfloat (with/without vorigin) — 4
- timeSplit on tint, tfloat, tbool, ttext (with/without torigin) — 8
- valueTimeSplit on tint and tfloat (3 origin-arg combinations each) — 6

Hooked into LoadInternal via a new RegisterTemporalTileSplit method on
TemporalTypes, kept distinct from the scalar registrations and the
existing tempUnnest TableFunction.

Test: test/sql/parity/025_temporal_tile_split.test (12 query cases)
covering all three function names on each supported base type, both
default-origin and explicit-origin variants, and a 3-column shape check
on valueTimeSplit output.
Full suite: 772 / 14 cases under TZ=UTC.
@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