@PublicEvolving public final class DistinctType extends UserDefinedType
A distinct type can always be cast to its source type and vice versa.
Distinct types are implicitly final and do not support super types.
Most other properties are forwarded from the source type. Thus, ordering and comparison among the same distinct types are supported.
The serialized string representation is the fully qualified name of this type which means that the type must have been registered in a catalog.
Modifier and Type | Class and Description |
---|---|
static class |
DistinctType.Builder
A builder for a
DistinctType . |
Modifier and Type | Method and Description |
---|---|
<R> R |
accept(LogicalTypeVisitor<R> visitor) |
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.
|
LogicalType |
getSourceType() |
int |
hashCode() |
static DistinctType.Builder |
newBuilder(ObjectIdentifier objectIdentifier,
LogicalType sourceType)
Creates a builder for a
DistinctType . |
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.
|
asSerializableString, getDescription, getObjectIdentifier, isFinal
asSummaryString, conversionSet, copy, getTypeRoot, is, is, isAnyOf, isAnyOf, isNullable, toString, withNullability
public static DistinctType.Builder newBuilder(ObjectIdentifier objectIdentifier, LogicalType sourceType)
DistinctType
.public LogicalType getSourceType()
public LogicalType copy(boolean isNullable)
LogicalType
copy
in class LogicalType
isNullable
- the intended nullability of the copied typepublic 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 UserDefinedType
public int hashCode()
hashCode
in class UserDefinedType
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.