@Public public abstract class DataType extends Object implements Serializable
DataTypes
,
Serialized FormConstructor and Description |
---|
DataType(boolean isNullable,
DataTypeRoot typeRoot) |
Modifier and Type | Method and Description |
---|---|
abstract <R> R |
accept(DataTypeVisitor<R> visitor) |
abstract String |
asSQLString()
Returns a string that summarizes this type as SQL standard string for printing to a console.
|
void |
collectFieldIds(Set<Integer> fieldIds) |
DataType |
copy()
Returns a deep copy of this type.
|
abstract DataType |
copy(boolean isNullable)
Returns a deep copy of this type with possibly different nullability.
|
boolean |
equals(Object o) |
boolean |
equalsIgnoreNullable(DataType o)
Compare two data types without nullable.
|
DataTypeRoot |
getTypeRoot()
Returns the root of this type.
|
int |
hashCode() |
boolean |
is(DataTypeFamily family)
Returns whether the family type of the type equals to the
family or not. |
boolean |
is(DataTypeRoot typeRoot)
Returns whether the root of the type equals to the
typeRoot or not. |
boolean |
isAnyOf(DataTypeFamily... typeFamilies)
Returns whether the root of the type is part of at least one family of the
typeFamily
or not. |
boolean |
isAnyOf(DataTypeRoot... typeRoots)
Returns whether the root of the type equals to at least on of the
typeRoots or not. |
boolean |
isNullable()
Returns whether a value of this type can be
null . |
DataType |
notNull() |
DataType |
nullable() |
void |
serializeJson(org.apache.paimon.shade.jackson2.com.fasterxml.jackson.core.JsonGenerator generator) |
String |
toString() |
protected String |
withNullability(String format,
Object... params) |
public DataType(boolean isNullable, DataTypeRoot typeRoot)
public boolean isNullable()
null
.public DataTypeRoot getTypeRoot()
public boolean is(DataTypeRoot typeRoot)
typeRoot
or not.typeRoot
- The root type to check against for equalitypublic boolean isAnyOf(DataTypeRoot... typeRoots)
typeRoots
or not.typeRoots
- The root types to check against for equalitypublic boolean isAnyOf(DataTypeFamily... typeFamilies)
typeFamily
or not.typeFamilies
- The families to check against for equalitypublic boolean is(DataTypeFamily family)
family
or not.family
- The family type to check against for equalitypublic abstract DataType copy(boolean isNullable)
isNullable
- the intended nullability of the copied typepublic final DataType copy()
copy(boolean)
.public boolean equalsIgnoreNullable(@Nonnull DataType o)
o
- the target data typepublic abstract String asSQLString()
public void serializeJson(org.apache.paimon.shade.jackson2.com.fasterxml.jackson.core.JsonGenerator generator) throws IOException
IOException
public abstract <R> R accept(DataTypeVisitor<R> visitor)
public DataType notNull()
public DataType nullable()
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.