Package io.delta.kernel.types
Class StructType
Object
io.delta.kernel.types.DataType
io.delta.kernel.types.StructType
Struct type which contains one or more columns.
- Since:
- 3.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(StructField field) add(String name, DataType dataType, boolean nullable, FieldMetadata metadata) add(String name, DataType dataType, FieldMetadata metadata) addMetadataColumn(String name, MetadataColumnSpec colType) Add a predefined metadata column ofMetadataColumnSpecto the struct type.at(int index) column(int ordinal) Creates aColumnexpression for the field at the givenordinalbooleancontains(MetadataColumnSpec spec) booleanbooleanequivalent(DataType dataType) Are the data types same? The metadata, collations or column names could be different.fields()inthashCode()intindexOf(MetadataColumnSpec spec) intbooleanisNested()Returns true iff this data is a nested data type (it logically parameterized by other types).booleanisWriteCompatible(DataType dataType) Checks whether the givendataTypeis compatible with this type when writing data.intlength()toJson()Convert the struct type to Delta protocol specified serialization format.toString()Methods inherited from class io.delta.kernel.types.DataType
isTypeValueBinaryLike
-
Constructor Details
-
StructType
public StructType() -
StructType
-
-
Method Details
-
add
-
add
-
add
-
add
-
add
-
addMetadataColumn
Add a predefined metadata column ofMetadataColumnSpecto the struct type. -
fields
- Returns:
- array of fields
-
fieldNames
- Returns:
- array of field names
-
length
public int length()- Returns:
- the number of fields
-
indexOf
- Returns:
- the index of the field with the given name, or -1 if not found
-
indexOf
- Returns:
- the index of the metadata column of the given spec, or -1 if not found
-
contains
- Returns:
- true if the struct type contains a metadata column of the given spec
-
get
-
at
-
column
Creates aColumnexpression for the field at the givenordinal- Parameters:
ordinal- the ordinal of theStructFieldto create a column for- Returns:
- a
Columnexpression for theStructFieldwith ordinalordinal
-
toJson
Convert the struct type to Delta protocol specified serialization format.- Returns:
- serialized in JSON format.
-
equivalent
Description copied from class:DataTypeAre the data types same? The metadata, collations or column names could be different.Should be used for schema comparisons during schema evolution.
- Overrides:
equivalentin classDataType- Parameters:
dataType-- Returns:
-
isWriteCompatible
Checks whether the givendataTypeis 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.
- Overrides:
isWriteCompatiblein classDataType- Parameters:
dataType- the input data type being written- Returns:
trueif the input type is compatible with this type.
-
isNested
public boolean isNested()Description copied from class:DataTypeReturns true iff this data is a nested data type (it logically parameterized by other types).For example StructType, ArrayType, MapType are nested data types.
-
toString
-
equals
-
hashCode
public int hashCode()
-