Class DataType

Object
io.delta.kernel.types.DataType
Direct Known Subclasses:
ArrayType, BasePrimitiveType, DecimalType, GeographyType, GeometryType, MapType, StructType

@Evolving public abstract class DataType extends Object
Base class for all data types.
Since:
3.0.0
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
     
    boolean
    equivalent(DataType dataType)
    Are the data types same? The metadata, collations or column names could be different.
    abstract int
     
    abstract boolean
    Returns true iff this data is a nested data type (it logically parameterized by other types).
    static boolean
    Returns true if the type value can be interpreted as raw bytes.
    boolean
    Checks whether the given dataType is compatible with this type when writing data.
    abstract String
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • DataType

      public DataType()
  • Method Details

    • isTypeValueBinaryLike

      public static boolean isTypeValueBinaryLike(DataType type)
      Returns true if the type value can be interpreted as raw bytes.
    • equivalent

      public boolean equivalent(DataType dataType)
      Are the data types same? The metadata, collations or column names could be different.

      Should be used for schema comparisons during schema evolution.

      Parameters:
      dataType -
      Returns:
    • isWriteCompatible

      public boolean isWriteCompatible(DataType dataType)
      Checks whether the given dataType is compatible with this type when writing data. Collation differences are ignored.

      This method is intended to be used during the write path to validate that an input type matches the expected schema before data is written.

      It should not be used in other cases, such as the read path.

      Parameters:
      dataType - the input data type being written
      Returns:
      true if the input type is compatible with this type.
    • isNested

      public abstract boolean isNested()
      Returns true iff this data is a nested data type (it logically parameterized by other types).

      For example StructType, ArrayType, MapType are nested data types.

    • hashCode

      public abstract int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public abstract boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object