Package io.delta.kernel.types
Class StringType
Object
io.delta.kernel.types.DataType
io.delta.kernel.types.BasePrimitiveType
io.delta.kernel.types.StringType
The data type representing
string type values.- Since:
- 3.0.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStringType(CollationIdentifier collationIdentifier) StringType(String collationName) -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanequivalent(DataType dataType) Are the data types same? The metadata, collations or column names could be different.booleanbooleanisWriteCompatible(DataType dataType) Checks whether the givendataTypeis compatible with this type when writing data.toString()Override is needed becausetoString()may be used for schema serialization and similar contexts, so collation information must be included.Methods inherited from class io.delta.kernel.types.BasePrimitiveType
createPrimitive, getAllPrimitiveTypes, hashCode, isNested, isPrimitiveTypeMethods inherited from class io.delta.kernel.types.DataType
isTypeValueBinaryLike
-
Field Details
-
STRING
-
-
Constructor Details
-
StringType
- Parameters:
collationIdentifier- An identifier representing the collation to be used for string comparison and sorting. This determines how strings will be ordered and compared in query operations.
-
StringType
- Parameters:
collationName- name of collation in which this StringType will be observed. In form ofPROVIDER.COLLATION_NAME[.VERSION]
-
-
Method Details
-
getCollationIdentifier
- Returns:
- StringType's collation identifier
-
equivalent
Are the data types same? The metadata, collations or column names could be different.- 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.
-
isUTF8BinaryCollated
public boolean isUTF8BinaryCollated()- Returns:
- true if this StringType uses the default Spark UTF8_BINARY collation.
-
equals
- Overrides:
equalsin classBasePrimitiveType
-
toString
Override is needed becausetoString()may be used for schema serialization and similar contexts, so collation information must be included.- Overrides:
toStringin classBasePrimitiveType- Returns:
- string representation of the StringType.
-