Skip to content

[Bug]: TS to TIMESTAMP conversion changes the absolute instant with session time zone #27637

Closed

Description

@XuPeng-SH

Problem

Converting an internal transaction timestamp (T_TS) to SQL TIMESTAMP through ts_to_time or CAST(TS AS TIMESTAMP) changed the underlying instant when the session time zone was not UTC.

Root cause

The conversion formatted the HLC physical Unix-nanosecond value as a UTC wall-clock string and reparsed that string in the session time zone. The parse therefore applied the session offset a second time. The same implementation also allocated and parsed a string for every row.

Expected behavior

The HLC physical component is already an absolute instant. Both conversion entry points must preserve its epoch value regardless of session time zone. The HLC logical component only orders events at the same physical instant and has no SQL TIMESTAMP representation.

Reproduction

Using a table-function metadata scan that exposes create_ts as T_TS:

  1. Set the session time zone to +08:00 and record min(unix_timestamp(ts_to_time(create_ts))) and min(unix_timestamp(cast(create_ts as timestamp(6)))).
  2. Set the session time zone to -05:00 and run the same two expressions.
  3. Before the fix, both epoch values change by the time-zone offset; the same create_ts no longer represents the same instant.

Resolution

PR #27636 converts the physical component directly, adds precision/NULL boundary coverage, and adds a BVT invariant for both conversion entry points across the two time zones.

Activity

  1. self-assigned this
    on Aug 26, 2026
  2. added
    kind/bug
    severity/s0
    on Aug 26, 2026
  3. added a commit that references this issue on Aug 26, 2026
    8e616a6
  4. added 3 commits that reference this issue on Sep 17, 2026
    a1c4616
    a54d5bc
    c2ecd73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions