@Stable
public class DataTypes
extends Object
Modifier and Type | Field and Description |
---|---|
static DataType |
BinaryType
Gets the BinaryType object.
|
static DataType |
BooleanType
Gets the BooleanType object.
|
static DataType |
ByteType
Gets the ByteType object.
|
static DataType |
CalendarIntervalType
Gets the CalendarIntervalType object.
|
static DataType |
DateType
Gets the DateType object.
|
static DataType |
DoubleType
Gets the DoubleType object.
|
static DataType |
FloatType
Gets the FloatType object.
|
static DataType |
IntegerType
Gets the IntegerType object.
|
static DataType |
LongType
Gets the LongType object.
|
static DataType |
NullType
Gets the NullType object.
|
static DataType |
ShortType
Gets the ShortType object.
|
static DataType |
StringType
Gets the StringType object.
|
static DataType |
TimestampNTZType
Gets the TimestampNTZType object.
|
static DataType |
TimestampType
Gets the TimestampType object.
|
Constructor and Description |
---|
DataTypes() |
Modifier and Type | Method and Description |
---|---|
static ArrayType |
createArrayType(DataType elementType)
Creates an ArrayType by specifying the data type of elements (
elementType ). |
static ArrayType |
createArrayType(DataType elementType,
boolean containsNull)
Creates an ArrayType by specifying the data type of elements (
elementType ) and
whether the array contains null values (containsNull ). |
static DayTimeIntervalType |
createDayTimeIntervalType()
Creates a DayTimeIntervalType with default start and end fields: interval day to second.
|
static DayTimeIntervalType |
createDayTimeIntervalType(byte startField,
byte endField)
Creates a DayTimeIntervalType by specifying the start and end fields.
|
static DecimalType |
createDecimalType()
Creates a DecimalType with default precision and scale, which are 10 and 0.
|
static DecimalType |
createDecimalType(int precision,
int scale)
Creates a DecimalType by specifying the precision and scale.
|
static MapType |
createMapType(DataType keyType,
DataType valueType)
Creates a MapType by specifying the data type of keys (
keyType ) and values
(keyType ). |
static MapType |
createMapType(DataType keyType,
DataType valueType,
boolean valueContainsNull)
Creates a MapType by specifying the data type of keys (
keyType ), the data type of
values (keyType ), and whether values contain any null value
(valueContainsNull ). |
static StructField |
createStructField(String name,
DataType dataType,
boolean nullable)
Creates a StructField with empty metadata.
|
static StructField |
createStructField(String name,
DataType dataType,
boolean nullable,
Metadata metadata)
Creates a StructField by specifying the name (
name ), data type (dataType ) and
whether values of this field can be null values (nullable ). |
static StructType |
createStructType(java.util.List<StructField> fields)
Creates a StructType with the given list of StructFields (
fields ). |
static StructType |
createStructType(StructField[] fields)
Creates a StructType with the given StructField array (
fields ). |
static YearMonthIntervalType |
createYearMonthIntervalType()
Creates a YearMonthIntervalType with default start and end fields: interval year to month.
|
static YearMonthIntervalType |
createYearMonthIntervalType(byte startField,
byte endField)
Creates a YearMonthIntervalType by specifying the start and end fields.
|
public static final DataType StringType
public static final DataType BinaryType
public static final DataType BooleanType
public static final DataType DateType
public static final DataType TimestampType
public static final DataType TimestampNTZType
public static final DataType CalendarIntervalType
public static final DataType DoubleType
public static final DataType FloatType
public static final DataType ByteType
public static final DataType IntegerType
public static final DataType LongType
public static final DataType ShortType
public static final DataType NullType
public static ArrayType createArrayType(DataType elementType)
elementType
).
The field of containsNull
is set to true
.public static ArrayType createArrayType(DataType elementType, boolean containsNull)
elementType
) and
whether the array contains null values (containsNull
).public static DecimalType createDecimalType(int precision, int scale)
public static DecimalType createDecimalType()
public static DayTimeIntervalType createDayTimeIntervalType(byte startField, byte endField)
public static DayTimeIntervalType createDayTimeIntervalType()
public static YearMonthIntervalType createYearMonthIntervalType(byte startField, byte endField)
public static YearMonthIntervalType createYearMonthIntervalType()
public static MapType createMapType(DataType keyType, DataType valueType)
keyType
) and values
(keyType
). The field of valueContainsNull
is set to true
.public static MapType createMapType(DataType keyType, DataType valueType, boolean valueContainsNull)
keyType
), the data type of
values (keyType
), and whether values contain any null value
(valueContainsNull
).public static StructField createStructField(String name, DataType dataType, boolean nullable, Metadata metadata)
name
), data type (dataType
) and
whether values of this field can be null values (nullable
).public static StructField createStructField(String name, DataType dataType, boolean nullable)
public static StructType createStructType(java.util.List<StructField> fields)
fields
).public static StructType createStructType(StructField[] fields)
fields
).