Class TimestampFlavourConversion
java.lang.Object
dev.frostlake.functions.scalar.conversion.TimestampFlavourConversion
The one conversion behind TO_TIMESTAMP and its TRY_ twins, handing back the value the call's flavour
holds: a TIMESTAMP_NTZ is a wall clock, a TIMESTAMP_LTZ the instant the input names shown in the
session's zone, and a TIMESTAMP_TZ that instant at an offset it keeps. What the input IS decides the
instant and, for a TZ, the offset:
input TIMESTAMP_LTZ TIMESTAMP_TZ a number (any scale) the epoch, in the session's zone the epoch, at the session's offset a string of digits the epoch, in the session's zone the epoch, at UTC text with no offset a wall clock in the session's zone the same, at the session's offset text with an offset re-expressed in the session's zone kept as written
So under America/Los_Angeles TO_TIMESTAMP_TZ(1579046400) is 2020-01-14 16:00:00 -0800 and
TO_TIMESTAMP_TZ('1579046400') is 2020-01-15 00:00:00 Z: one instant, two offsets. A VARIANT is
read by what it holds — a number as a number (seconds, never unit-detected), a string as text, the JSON
null as NULL — and any other variant is refused. Live-verified, every cell.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ObjectcastVariant(String flavour, VariantValue variant) A VARIANT cast to a timestamp flavour, which reads it exactly as the flavour's conversion function does: a number is an epoch in seconds, the instant in the session's zone, and a boolean or a container fails the cast (live-verified).
-
Method Details
-
castVariant
A VARIANT cast to a timestamp flavour, which reads it exactly as the flavour's conversion function does: a number is an epoch in seconds, the instant in the session's zone, and a boolean or a container fails the cast (live-verified).- Parameters:
flavour- TIMESTAMP_NTZ, TIMESTAMP_LTZ or TIMESTAMP_TZvariant- the value to convert- Returns:
- the value in the flavour's carrier, or null for the JSON null
-