@PublicEvolving public final class YearMonthIntervalType extends LogicalType
An interval of year-month consists of +years-months with values ranging from -9999-11 to +9999-11. The value representation is the same for all types of resolutions.
For example, an interval of months of 50 is always represented in an interval-of-years-to-months
format (with default year precision): +04-02.
The serialized string representation is INTERVAL YEAR(p), INTERVAL YEAR(p) TO
MONTH, or INTERVAL MONTH where p is the number of digits of years (=year
precision). p must have a value between 1 and 4 (both inclusive). If no year precision is
specified, p is equal to 2.
A conversion from and to int describes the number of months. A conversion from Period ignores the days part.
DayTimeIntervalType,
序列化表格| 限定符和类型 | 类和说明 |
|---|---|
static class |
YearMonthIntervalType.YearMonthResolution
Supported resolutions of this type.
|
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_PRECISION |
static int |
MAX_PRECISION |
static int |
MIN_PRECISION |
| 构造器和说明 |
|---|
YearMonthIntervalType(boolean isNullable,
YearMonthIntervalType.YearMonthResolution resolution,
int yearPrecision) |
YearMonthIntervalType(YearMonthIntervalType.YearMonthResolution resolution) |
YearMonthIntervalType(YearMonthIntervalType.YearMonthResolution resolution,
int yearPrecision) |
| 限定符和类型 | 方法和说明 |
|---|---|
<R> R |
accept(LogicalTypeVisitor<R> visitor) |
String |
asSerializableString()
Returns a string that fully serializes this instance.
|
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.
|
YearMonthIntervalType.YearMonthResolution |
getResolution() |
int |
getYearPrecision() |
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.
|
asSummaryString, conversionSet, copy, getTypeRoot, isNullable, toString, withNullabilitypublic static final int MIN_PRECISION
public static final int MAX_PRECISION
public static final int DEFAULT_PRECISION
public YearMonthIntervalType(boolean isNullable,
YearMonthIntervalType.YearMonthResolution resolution,
int yearPrecision)
public YearMonthIntervalType(YearMonthIntervalType.YearMonthResolution resolution, int yearPrecision)
public YearMonthIntervalType(YearMonthIntervalType.YearMonthResolution resolution)
public YearMonthIntervalType.YearMonthResolution getResolution()
public int getYearPrecision()
public LogicalType copy(boolean isNullable)
LogicalTypecopy 在类中 LogicalTypeisNullable - the intended nullability of the copied typepublic String asSerializableString()
LogicalTypeSee LogicalTypeParser for the reverse operation.
asSerializableString 在类中 LogicalTypepublic boolean supportsInputConversion(Class<?> clazz)
LogicalTypeA 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 在类中 LogicalTypeclazz - input class to be converted into this logical typeLogicalType.getDefaultConversion()public boolean supportsOutputConversion(Class<?> clazz)
LogicalTypeA 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 在类中 LogicalTypeclazz - output class to be converted from this logical typeLogicalType.getDefaultConversion()public Class<?> getDefaultConversion()
LogicalTypeFor example, java.lang.Long is the default input and output for BIGINT.
getDefaultConversion 在类中 LogicalTypeLogicalType.supportsInputConversion(Class),
LogicalType.supportsOutputConversion(Class)public List<LogicalType> getChildren()
getChildren 在类中 LogicalTypepublic <R> R accept(LogicalTypeVisitor<R> visitor)
accept 在类中 LogicalTypepublic boolean equals(Object o)
equals 在类中 LogicalTypepublic int hashCode()
hashCode 在类中 LogicalTypeCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.