Styxis
Company
Knowledge

Test Trino timestamp casts near their representation limit

Check timestamp precision conversion near the upper bound against a reference preserving the full year and fractional seconds. Coercing inputs into a narrower date range can erase the discrepancy under investigation.

Bound the permitted precision change

Reducing timestamp precision may change fractional seconds, but should not move the year by thousands. A boundary fixture should preserve raw text and arbitrary-precision reference calculations before Truthound Core compares the results. [1, 2, 3]

A representation-limit report

Trino issue #31564 reports timestamp casts near the representation limit on 483 producing a much earlier year or failing to return a valid value. Ordinary present-day rounding tests do not exercise this capacity boundary. The article treats that behavior as a version-scoped report. [1]

Preserve the source before checking

Retain raw epoch integers and timestamp text near the supported upper bound. Derive each requested precision with an independent calculation. Do not force the source through Python datetime or a Polars timestamp range before comparison: preprocessing can damage the very value under investigation. [1, 3]

A complete date witness

For +294247-01-10 04:00:54.775807 cast to timestamp(4), the reference text is 294247-01-10 04:00:54.7758. That passes. The reported 290309-12-21 19:59:05.2243 changes the date itself and fails; it is not a permitted fractional precision adjustment. [1, 3]

Compare lossless text

ColumnPairValidator in Truthound Core Python SDK 3.3.2 can compare non-null, lossless source-derived text with output text. The operator defines normalization and target rounding. The SDK does not extend engine timestamp capacity or supply an arbitrary-precision calendar implementation. [1, 2, 3]

Separate business and representation ranges

If the business domain has a narrower date range, validate that range explicitly. Otherwise retain a representation supporting the necessary upper bound. Test normal dates and representation limits separately rather than inferring one from the other. [1, 3]

Parseability does not preserve the date

A parseable date is insufficient evidence when it represents a different year. Keep the complete year, date, fraction, and precision together in the acceptance artifact so display truncation cannot conceal the shift. [1, 3]

Application conditions

Prepare near-limit timestamps as raw text with an arbitrary-precision reference.

Alternatives

Declare the business date range or use a representation supporting the required bound.

Limitations

  • Forcing the input into a datetime range can damage it before validation.

Evidence

Event checked
Subject checked
Modified