Class DataTypes


@Stable public class DataTypes extends Object
To get/create specific data type, users should use singleton objects and factory methods provided by this class.
  • Field Details

    • StringType

      public static final DataType StringType
      Gets the StringType object.
    • BinaryType

      public static final DataType BinaryType
      Gets the BinaryType object.
    • BooleanType

      public static final DataType BooleanType
      Gets the BooleanType object.
    • DateType

      public static final DataType DateType
      Gets the DateType object.
    • TimestampType

      public static final DataType TimestampType
      Gets the TimestampType object.
    • TimestampNTZType

      public static final DataType TimestampNTZType
      Gets the TimestampNTZType object.
    • CalendarIntervalType

      public static final DataType CalendarIntervalType
      Gets the CalendarIntervalType object.
    • DoubleType

      public static final DataType DoubleType
      Gets the DoubleType object.
    • FloatType

      public static final DataType FloatType
      Gets the FloatType object.
    • ByteType

      public static final DataType ByteType
      Gets the ByteType object.
    • IntegerType

      public static final DataType IntegerType
      Gets the IntegerType object.
    • LongType

      public static final DataType LongType
      Gets the LongType object.
    • ShortType

      public static final DataType ShortType
      Gets the ShortType object.
    • NullType

      public static final DataType NullType
      Gets the NullType object.
  • Constructor Details

    • DataTypes

      public DataTypes()
  • Method Details

    • createArrayType

      public static ArrayType createArrayType(DataType elementType)
      Creates an ArrayType by specifying the data type of elements (elementType). The field of containsNull is set to true.
    • createArrayType

      public 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).
    • createDecimalType

      public static DecimalType createDecimalType(int precision, int scale)
      Creates a DecimalType by specifying the precision and scale.
    • createDecimalType

      public static DecimalType createDecimalType()
      Creates a DecimalType with default precision and scale, which are 10 and 0.
    • createDayTimeIntervalType

      public static DayTimeIntervalType createDayTimeIntervalType(byte startField, byte endField)
      Creates a DayTimeIntervalType by specifying the start and end fields.
    • createDayTimeIntervalType

      public static DayTimeIntervalType createDayTimeIntervalType()
      Creates a DayTimeIntervalType with default start and end fields: interval day to second.
    • createYearMonthIntervalType

      public static YearMonthIntervalType createYearMonthIntervalType(byte startField, byte endField)
      Creates a YearMonthIntervalType by specifying the start and end fields.
    • createYearMonthIntervalType

      public static YearMonthIntervalType createYearMonthIntervalType()
      Creates a YearMonthIntervalType with default start and end fields: interval year to month.
    • createMapType

      public static MapType createMapType(DataType keyType, DataType valueType)
      Creates a MapType by specifying the data type of keys (keyType) and values (keyType). The field of valueContainsNull is set to true.
    • createMapType

      public 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).
    • createStructField

      public 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).
    • createStructField

      public static StructField createStructField(String name, DataType dataType, boolean nullable)
      Creates a StructField with empty metadata.
      See Also:
    • createStructType

      public static StructType createStructType(List<StructField> fields)
      Creates a StructType with the given list of StructFields (fields).
    • createStructType

      public static StructType createStructType(StructField[] fields)
      Creates a StructType with the given StructField array (fields).