Skip to content

feat(bindings): tnumber math followups — exp/ln/log10, deltaValue, trend, named-function aliases#71

Closed
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-tnumber-mathfuncs-followups
Closed

feat(bindings): tnumber math followups — exp/ln/log10, deltaValue, trend, named-function aliases#71
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-tnumber-mathfuncs-followups

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Closes the user-facing tail of `temporal/026_tnumber_mathfuncs` (was 47%; this brings the user-visible surface to ~100%).

New SQL surface

Unary tfloat math

Signature Routed through
`exp(tfloat)` -> `tfloat` `tfloat_exp`
`ln(tfloat)` -> `tfloat` `tfloat_ln`
`log10(tfloat)` -> `tfloat` `tfloat_log10`

Unary tnumber

Signature Notes
`deltaValue(tint)` -> `tint` successive differences
`deltaValue(tfloat)` -> `tfloat` same
`trend(tint)` -> `tint` sign of slope
`trend(tfloat)` -> `tint` matches MobilityDB's odd return-type choice (`tint` even on `tfloat` input)

Named-function aliases for the arithmetic operators

`tnumber_add` / `tnumber_sub` / `tnumber_mult` / `tnumber_div` — 6 overloads each (`int × tint`, `tint × int`, `tint × tint`, `float × tfloat`, `tfloat × float`, `tfloat × tfloat`).

These route through the same handlers as the existing `+`/`-`/`*`/`/` operator forms; MobilityDB exposes both names. Verified via assertions like `tnumber_add(tfloat '...', 4.0) = (tfloat '...' + 4.0)` -> `true`.

Tests

  • `test/sql/parity/026b_tnumber_mathfuncs_followups.test` — 12 assertions covering each new surface and the operator-alias equivalence.
  • Full suite: 764 assertions / 14 test cases passing under `TZ=UTC`.

Coverage delta

Per the audit in PR #66:

  • `temporal/026_tnumber_mathfuncs`: 8/17 (47%) → 17/17 (100%) by name.

Test plan

  • `cmake --build . --target shell unittest` clean
  • New parity test passes (12/12)
  • Full suite green (764/14)

…end, named-function aliases

Closes the user-facing tail of temporal/026_tnumber_mathfuncs:

Unary tfloat:
- exp(tfloat)   -> tfloat   (tfloat_exp)
- ln(tfloat)    -> tfloat   (tfloat_ln)
- log10(tfloat) -> tfloat   (tfloat_log10)

Unary tnumber:
- deltaValue(tint)   -> tint
- deltaValue(tfloat) -> tfloat
- trend(tint)        -> tint
- trend(tfloat)      -> tint   (matches MobilityDB's return type)

Named-function aliases for the existing arithmetic operators (MobilityDB
exposes both forms; the operator versions were already wired):
- tnumber_add  / sub / mult / div   (24 overloads each = 6 × 4 names)
  routing through the same Add/Sub/Mult/Div_*_* handlers as the
  `+`/`-`/`*`/`/` operator forms.

Test: test/sql/parity/026b_tnumber_mathfuncs_followups.test
(12 assertions). Full suite: 764 / 14 cases under TZ=UTC.

Files also gain a trailing newline at EOF (per general repo hygiene).
@estebanzimanyi estebanzimanyi marked this pull request as ready for review May 1, 2026 19:13
@estebanzimanyi
Copy link
Copy Markdown
Member Author

Superseded by the consolidated PR branch consolidate/analytics-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