Expand description
Shared timestamp-unit normalization for all STT input adaptors.
Every input reader — the GeoParquet scalar (--time-field) and per-vertex
(vertex_timestamps) paths in stt-build, the DuckDB reader, and the
stt-optimize analysis loader — must scale a producer’s raw integer
timestamp to the STT wire unit (Unix milliseconds) identically. This is
the one source of truth for that arithmetic so a new reader can’t silently
disagree.
Enums§
- Timestamp
Unit - Precision of a raw integer timestamp value. Used to normalize any producer’s unit to the STT wire unit (Unix milliseconds).
Functions§
- normalize_
timestamp_ to_ ms - Normalize a raw integer timestamp
valueinunitto Unix milliseconds, rejecting pre-1970 (negative) instants and overflow-checking the second→millisecond multiply.rowis the absolute row index, used only for error context. - reject_
negative_ timestamp - Pre-1970 timestamps cannot be represented — the temporal index stores
unsigned ms-since-epoch, so a negative value would wrap to a huge
positive one (
as u64) and silently corrupt the index. This hard-errors regardless of strictness mode; coercion is never sound here. - scale_
timestamp_ to_ ms - Scale a raw timestamp
valueinunitto signed Unix milliseconds WITHOUT the non-negative guard. Second→ms is overflow-CHECKED (any realistic date fits; a value that doesn’t is corrupt input and must error, never silently saturate). This is the single source of truth for timestamp-unit scaling arithmetic —Second×1000,Millisecondpassthrough,Microsecond÷1_000,Nanosecond÷1_000_000 — shared bynormalize_timestamp_to_ms(which adds the guard +u64cast) and the DuckDB reader’stimestamp_unit_to_ms(which keeps signed ms so a timestamp emitted as a plain property may legitimately be pre-1970). Callers that need a wire timestamp applyreject_negative_timestampthemselves.