Class SessionTimestampMapping

java.lang.Object
dev.frostlake.executor.SessionTimestampMapping

public final class SessionTimestampMapping extends Object
The flavour a BARE TIMESTAMP means, which the session's TIMESTAMP_TYPE_MAPPING parameter names.

Live resolves the bare word against whatever the mapping says AT THE MOMENT it is written, on every spelling that can carry it — CAST(x AS TIMESTAMP), x::TIMESTAMP, TO_TIMESTAMP(x) and a column declared TIMESTAMP. It is resolved ONCE and kept: a column created under TIMESTAMP_LTZ still describes as TIMESTAMP_LTZ after the session switches back.

DATETIME does NOT follow it. It is an alias for TIMESTAMP_NTZ specifically, not for the mapped TIMESTAMP, and stays NTZ under every mapping — measured on both engines. The three explicit spellings are likewise untouched; only the bare word is unresolved.

Held in a ThreadLocal pinned for the statement, the same way SessionZone carries the session's zone into the value layer, and for the same reason: one engine serves many sessions.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    What a bare TIMESTAMP means when nothing has set the parameter.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    The flavour a bare TIMESTAMP currently means.
    static boolean
    Whether the mapping names a zone-carrying flavour, which is the only case that changes anything.
    static String
    pin(Object mappingName)
    Pin this statement's mapping, returning what was pinned before so the caller can restore it.
    static void
    restore(String previous)
    Put back whatever pin(java.lang.Object) displaced; a null restores the unpinned state.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT

      public static final String DEFAULT
      What a bare TIMESTAMP means when nothing has set the parameter.
      See Also:
  • Method Details

    • current

      public static String current()
      The flavour a bare TIMESTAMP currently means.
    • isZoned

      public static boolean isZoned()
      Whether the mapping names a zone-carrying flavour, which is the only case that changes anything.
    • pin

      public static String pin(Object mappingName)
      Pin this statement's mapping, returning what was pinned before so the caller can restore it. The value is validated where it is SET, so an unrecognised one simply falls back to the default.
    • restore

      public static void restore(String previous)
      Put back whatever pin(java.lang.Object) displaced; a null restores the unpinned state.