@PublicEvolving public final class LocalZonedTimestampType extends LogicalType
year-month-day
hour:minute:second[.fractional] zone
with up to nanosecond precision and values ranging from
0000-01-01 00:00:00.000000000 +14:59
to 9999-12-31 23:59:59.999999999 -14:59
.
Leap seconds (23:59:60 and 23:59:61) are not supported as the semantics are closer to OffsetDateTime
.
The serialized string representation is TIMESTAMP(p) WITH LOCAL TIME ZONE
where p
is the number of digits of fractional seconds (=precision). p
must have a value
between 0 and 9 (both inclusive). If no precision is specified, p
is equal to 6. TIMESTAMP_LTZ(p)
is a synonym.
Compared to ZonedTimestampType
, the time zone offset information is not stored
physically in every datum. Instead, the type assumes Instant
semantics in UTC
time zone at the edges of the table ecosystem. Every datum is interpreted in the local time zone
configured in the current session for computation and visualization.
This type fills the gap between time zone free and time zone mandatory timestamp types by
allowing the interpretation of UTC timestamps according to the configured session time zone. A
conversion from and to int
describes the number of seconds since epoch. A conversion from
and to long
describes the number of milliseconds since epoch.
TimestampType
,
ZonedTimestampType
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRECISION |
static int |
MAX_PRECISION |
static int |
MIN_PRECISION |
Constructor and Description |
---|
LocalZonedTimestampType() |
LocalZonedTimestampType(boolean isNullable,
int precision) |
LocalZonedTimestampType(boolean isNullable,
TimestampKind kind,
int precision)
Internal constructor that allows attaching additional metadata about time attribute
properties.
|
LocalZonedTimestampType(int precision) |
Modifier and Type | Method and Description |
---|---|
<R> R |
accept(LogicalTypeVisitor<R> visitor) |
String |
asSerializableString()
Returns a string that fully serializes this instance.
|
String |
asSummaryString()
Returns a string that summarizes this type for printing to a console.
|
LogicalType |
copy(boolean isNullable)
Returns a deep copy of this type with possibly different nullability.
|
boolean |
equals(Object o) |
List<LogicalType> |
getChildren() |
Class<?> |
getDefaultConversion()
Returns the default conversion class.
|
TimestampKind |
getKind() |
int |
getPrecision() |
int |
hashCode() |
boolean |
supportsInputConversion(Class<?> clazz)
Returns whether an instance of the given class can be represented as a value of this logical
type when entering the table ecosystem.
|
boolean |
supportsOutputConversion(Class<?> clazz)
Returns whether a value of this logical type can be represented as an instance of the given
class when leaving the table ecosystem.
|
conversionSet, copy, getTypeRoot, is, is, isAnyOf, isAnyOf, isNullable, toString, withNullability
public static final int MIN_PRECISION
public static final int MAX_PRECISION
public static final int DEFAULT_PRECISION
@Internal public LocalZonedTimestampType(boolean isNullable, TimestampKind kind, int precision)
Use getKind()
for comparing this metadata.
public LocalZonedTimestampType(boolean isNullable, int precision)
public LocalZonedTimestampType(int precision)
public LocalZonedTimestampType()
@Internal public TimestampKind getKind()
public int getPrecision()
public LogicalType copy(boolean isNullable)
LogicalType
copy
in class LogicalType
isNullable
- the intended nullability of the copied typepublic String asSerializableString()
LogicalType
See LogicalTypeParser
for the reverse operation.
asSerializableString
in class LogicalType
public String asSummaryString()
LogicalType
Use LogicalType.asSerializableString()
for a type string that fully serializes this instance.
asSummaryString
in class LogicalType
public boolean supportsInputConversion(Class<?> clazz)
LogicalType
A supported conversion directly maps an input class to a logical type without loss of precision or type widening.
For example, java.lang.Long
or long
can be used as input for BIGINT
independent of the set nullability.
supportsInputConversion
in class LogicalType
clazz
- input class to be converted into this logical typeLogicalType.getDefaultConversion()
public boolean supportsOutputConversion(Class<?> clazz)
LogicalType
A supported conversion directly maps a logical type to an output class without loss of precision or type widening.
For example, java.lang.Long
or long
can be used as output for BIGINT
if the type is not nullable. If the type is nullable, only java.lang.Long
can
represent this.
supportsOutputConversion
in class LogicalType
clazz
- output class to be converted from this logical typeLogicalType.getDefaultConversion()
public Class<?> getDefaultConversion()
LogicalType
For example, java.lang.Long
is the default input and output for BIGINT
.
getDefaultConversion
in class LogicalType
LogicalType.supportsInputConversion(Class)
,
LogicalType.supportsOutputConversion(Class)
public List<LogicalType> getChildren()
getChildren
in class LogicalType
public <R> R accept(LogicalTypeVisitor<R> visitor)
accept
in class LogicalType
public boolean equals(Object o)
equals
in class LogicalType
public int hashCode()
hashCode
in class LogicalType
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.