Modifier and Type | Method and Description |
---|---|
static TableSchema |
expandCompositeTypeToSchema(DataType dataType)
Expands a composite
DataType to a corresponding TableSchema . |
static boolean |
isInternal(DataType dataType)
Checks whether a given data type is an internal data structure.
|
static DataType |
replaceLogicalType(DataType dataType,
LogicalType replacement)
Replaces the
LogicalType of a DataType , i.e., it keeps the bridging class. |
static DataType |
transform(DataType typeToTransform,
TypeTransformation... transformations)
Transforms the given data type (can be nested) to a different data type using the given
transformations.
|
public static boolean isInternal(DataType dataType)
public static DataType replaceLogicalType(DataType dataType, LogicalType replacement)
LogicalType
of a DataType
, i.e., it keeps the bridging class.public static DataType transform(DataType typeToTransform, TypeTransformation... transformations)
typeToTransform
- data type to be transformed.transformations
- the transformations to transform data type to another type.public static TableSchema expandCompositeTypeToSchema(DataType dataType)
DataType
to a corresponding TableSchema
. Useful for
flattening a column or mapping a physical to logical type of a table source
Throws an exception for a non composite type. You can use LogicalTypeChecks.isCompositeType(LogicalType)
to check that.
It does not expand an atomic type on purpose, because that operation depends on the
context. E.g. in case of a FLATTEN
function such operation is not allowed, whereas
when mapping a physical type to logical the field name should be derived from the logical
schema.
dataType
- Data type to expand. Must be a composite type.Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.