public abstract class DataType
extends Object
Constructor and Description |
---|
DataType() |
Modifier and Type | Method and Description |
---|---|
String |
catalogString()
String representation for the type saved in external catalogs.
|
abstract int |
defaultSize()
The default size of a value of this data type, used internally for size estimation.
|
static boolean |
equalsIgnoreCaseAndNullability(DataType from,
DataType to)
Compares two types, ignoring nullability of ArrayType, MapType, StructType, and ignoring case
sensitivity of field names in StructType.
|
static boolean |
equalsIgnoreNullability(DataType left,
DataType right)
Compares two types, ignoring nullability of ArrayType, MapType, StructType.
|
static boolean |
equalsStructurally(DataType from,
DataType to,
boolean ignoreNullability)
Returns true if the two data types share the same "shape", i.e.
|
static boolean |
equalsStructurallyByName(DataType from,
DataType to,
scala.Function2<String,String,Object> resolver)
Returns true if the two data types have the same field names in order recursively.
|
static DataType |
fromDDL(String ddl) |
static DataType |
fromJson(String json) |
String |
json()
The compact JSON representation of this data type.
|
static DataType |
parseTypeWithFallback(String schema,
scala.Function1<String,DataType> parser,
scala.Function1<String,DataType> fallbackParser)
Parses data type from a string with schema.
|
String |
prettyJson()
The pretty (i.e.
|
String |
simpleString()
Readable string representation for the type.
|
String |
sql() |
String |
typeName()
Name of the type used in JSON serialization.
|
public static DataType fromDDL(String ddl)
public static DataType parseTypeWithFallback(String schema, scala.Function1<String,DataType> parser, scala.Function1<String,DataType> fallbackParser)
parser
for schema
.
If it fails, calls fallbackParser
. If the fallback function fails too, combines error message
from parser
and fallbackParser
.
schema
- The schema string to parse by parser
or fallbackParser
.parser
- The function that should be invoke firstly.fallbackParser
- The function that is called when parser
fails.schema
schema.public static DataType fromJson(String json)
public static boolean equalsStructurally(DataType from, DataType to, boolean ignoreNullability)
ignoreNullability
- whether to ignore nullability when comparing the typesfrom
- (undocumented)to
- (undocumented)public static boolean equalsStructurallyByName(DataType from, DataType to, scala.Function2<String,String,Object> resolver)
from
- (undocumented)to
- (undocumented)resolver
- (undocumented)public static boolean equalsIgnoreNullability(DataType left, DataType right)
left
- (undocumented)right
- (undocumented)public static boolean equalsIgnoreCaseAndNullability(DataType from, DataType to)
from
- (undocumented)to
- (undocumented)public abstract int defaultSize()
public String typeName()
public String json()
public String prettyJson()
public String simpleString()
public String catalogString()
public String sql()