Skip to content

Generate temporal_hash_extended over all temporal families - #226

Closed
estebanzimanyi wants to merge 2 commits into
mainfrom
feat/duck-hash-extended
Closed

Generate temporal_hash_extended over all temporal families#226
estebanzimanyi wants to merge 2 commits into
mainfrom
feat/duck-hash-extended

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Generates the extended (64-bit, seeded) hash temporal_hash_extended(<ttype>, UBIGINT) for every temporal family, inherited through Temporal<T> — the Duck side of the MEOS temporal_hash_extended surface.

The uint64 hash and its seed use DuckDB's native UBIGINT, not a signed BIGINT: a MEOS hash fills the full unsigned range. For example temporal_hash_extended(tint '1@2000-01-01', 0) = 11445401048662056440, which is greater than 2**63 and does not fit in a signed BIGINT; DuckDB range-checks the cast rather than bit-reinterpreting the way PostgreSQL/C do. temporal_hash (uint32) analogously stays UINTEGER.

  • Generator: keys uint64_t to UBIGINT in the scalar arg/return maps (SCALAR, SCALAR_ARG, SCALAR_RET_CPP), so the existing (Temporal, scalar)->scalar binary shape emits it.
  • Checks the Tcell cell-id branch before the generic scalar branch in ret_type and shape_emittable, so a uint64 cell id keeps its cell type (th3index/tquadbin startValue) instead of collapsing to UBIGINT.
  • test/sql/temporal_hash.test: temporal_hash (UINTEGER) and temporal_hash_extended (UBIGINT, seed-sensitive, full uint64 range) across temporal families.

nhungoc1508 and others added 2 commits July 22, 2026 21:40
…ical

Regenerates the generated UDF surface from MobilityDB master (which brings in
the generic temporal_hash surface). The MEOS-API catalog now renders the uint32
canonical type as `unsigned int` (it was `uint32_t`); key the scalar type maps
on it so the *_hash functions keep registering instead of being dropped.

uint32 hashes map to DuckDB's native `UINTEGER`, not a signed `INTEGER` — a hash
>= 2**31 is out of range for INT32 and DuckDB range-checks the cast rather than
bit-reinterpreting the way PostgreSQL/C do; DuckDB has real unsigned SQL types,
so `UINTEGER` is the faithful representation.
Generates the extended (64-bit, seeded) hash `temporal_hash_extended(<ttype>,
UBIGINT)` for every temporal family, inherited through Temporal<T> — the Duck
side of the MEOS temporal_hash_extended surface.

The uint64 hash and its seed use DuckDB's native `UBIGINT`, not a signed BIGINT:
a MEOS hash fills the full unsigned range (e.g. temporal_hash_extended(tint
'1@2000-01-01', 0) = 11445401048662056440, which is > 2**63 and does not fit in
a signed BIGINT), and DuckDB range-checks the cast rather than bit-reinterpreting
the way PostgreSQL/C do.

Generator: key uint64_t to UBIGINT in the scalar arg/return maps (SCALAR,
SCALAR_ARG, SCALAR_RET_CPP), and check the Tcell cell-id branch before the
generic scalar branch in ret_type and shape_emittable so a uint64 cell id keeps
its cell type instead of collapsing to UBIGINT.
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.

2 participants