Package dev.frostlake.executor
Class SessionZone
java.lang.Object
dev.frostlake.executor.SessionZone
The zone the session's TIMEZONE parameter names, reachable from the value layer.
A TIMESTAMP_LTZ is an INSTANT, and the wall clock it shows is that instant read in the SESSION's
zone — so the same stored value renders 2020-01-01 10:00:00 -0800 under
America/Los_Angeles and 2020-01-01 18:00:00 Z under UTC. Reading and rendering one
therefore needs the session's zone, and both happen deep inside static helpers that have no session
to ask.
Held in a ThreadLocal and pinned for the statement, exactly as StatementClock pins the
statement's instant and for the same reason: one engine serves many sessions, so this must not be a
process-wide setting. The default is UTC, which is what the engine used everywhere before the
parameter was read at all.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ZoneIdcurrent()The session's zone, or UTC when nothing is pinned.static ZoneIdPin this statement's zone, returning what was pinned before so the caller can restore it.static voidPut back whateverpin(java.lang.Object)displaced; a null restores the unpinned state.
-
Method Details
-
current
The session's zone, or UTC when nothing is pinned. -
pin
Pin this statement's zone, returning what was pinned before so the caller can restore it. An unusable or absent name leaves UTC rather than raising: the parameter is validated where it is SET, and a rendering path is the wrong place to discover a bad one. -
restore
Put back whateverpin(java.lang.Object)displaced; a null restores the unpinned state.
-