Skip to content

feat(bindings): temporal topological predicates (@>, <@, &&, -|-) — 96 registrations#32

Closed
estebanzimanyi wants to merge 1 commit intofeat/tnumber-distancefrom
feat/temporal-topops
Closed

feat(bindings): temporal topological predicates (@>, <@, &&, -|-) — 96 registrations#32
estebanzimanyi wants to merge 1 commit intofeat/tnumber-distancefrom
feat/temporal-topops

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Adds 96 ScalarFunction registrations covering the temporal-side topological-operator surface, backed by 12 wrapper implementations:

Surface Count MEOS
temporal × temporal 64 (4 ops × 4×4 type pairs) contains/contained/overlaps/adjacent_temporal_temporal
temporal × tstzspan 16 contains/contained/overlaps/adjacent_temporal_tstzspan
tstzspan × temporal 16 reverse-order via inverse op (e.g. tstzspan @> temporalcontained_temporal_tstzspan(t, s))

All four temporal types (tbool, tint, tfloat, ttext) × all four operators (@>, <@, &&, -|-).

Three small templated helpers added (TempTempBoolPred, TempSpanBoolPred, SpanTempBoolPred) to keep each ScalarFunction body to one line.

Smoke test

SELECT tint '[1@01-01, 5@01-05]' @> tint '[3@01-02, 4@01-04]';   -- true
SELECT tint '[3@01-02, 4@01-04]' <@ tint '[1@01-01, 5@01-05]';   -- true
SELECT tint '[1@01-01, 5@01-05]' && tint '[3@01-03, 7@01-07]';   -- true
SELECT tint '[1@01-01, 5@01-05]' @> tstzspan '[01-02, 01-04]';   -- true
SELECT tstzspan '[01-01, 01-10]' @> tint '[2@01-02, 4@01-04]';   -- true

Test plan

Dependencies

Stacked on PR #31 (tnumber distance). Merge order: #27#29#30#31 → this.

Adds 96 ScalarFunction registrations covering the temporal-side
topological operator surface, backed by 12 wrapper implementations.

Coverage:
- temporal × temporal (16 = 4 ops × 4×4 type pairs)
  Uses MEOS contains/contained/overlaps/adjacent_temporal_temporal
  (one polymorphic function each, dispatching internally on the
  temporal subtype).
- temporal × tstzspan (16 = 4 ops × 4 temporal types × 1 span type)
  Uses MEOS contains/contained/overlaps/adjacent_temporal_tstzspan.
- tstzspan × temporal (16 = 4 ops × 4 temporal types, reverse direction)
  MEOS only exposes the temporal-span direction, so the reverse
  registrations swap arg order and use the inverse op
  (contains <-> contained), so for example
    `tstzspan @> temporal` calls `contained_temporal_tstzspan(t, s)`.
- All 4 temporal types (tbool, tint, tfloat, ttext) × all 4 ops.

Three small templated helpers added (TempTempBoolPred,
TempSpanBoolPred, SpanTempBoolPred) to keep each ScalarFunction body
to one line.

Smoke test:
  SELECT tint '[1@01-01, 5@01-05]' @> tint '[3@01-02, 4@01-04]';   -- true
  SELECT tint '[3@01-02, 4@01-04]' <@ tint '[1@01-01, 5@01-05]';   -- true
  SELECT tint '[1@01-01, 5@01-05]' && tint '[3@01-03, 7@01-07]';   -- true
  SELECT tint '[1@01-01, 5@01-05]' @> tstzspan '[01-02, 01-04]';   -- true
  SELECT tstzspan '[01-01, 01-10]' @> tint '[2@01-02, 4@01-04]';   -- true

Stacked on PR #31 (tnumber distance).

Full suite passes (747 assertions, 13 test cases).
@estebanzimanyi
Copy link
Copy Markdown
Member Author

Consolidated into #42 (temporal time-domain predicates — topo + position combined).

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