Package io.delta.kernel.internal.types
Class TypeWideningChecker
Object
io.delta.kernel.internal.types.TypeWideningChecker
Utility class for checking type widening compatibility according to the Delta protocol.
The Type Widening feature enables changing the type of a column or field in an existing Delta table to a wider type. This class implements the checks required by the protocol to ensure that only supported type changes are allowed.
Supported type changes as per protocol:
- Integer widening:
Byte -> Short -> Int -> Long - Floating-point widening:
Float -> Double - Floating-point widening:
Byte, Short or Int -> Double - Date widening:
Date -> Timestamp without timezone - Decimal widening:
Decimal(p, s) -> Decimal(p + k1, s + k2)wherek1 >= k2 >= 0 - Decimal widening:
Byte, Short or Int -> Decimal(10 + k1, k2)wherek1 >= k2 >= 0 - Decimal widening:
Long -> Decimal(20 + k1, k2)wherek1 >= k2 >= 0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisIcebergV2Compatible(DataType sourceType, DataType targetType) Checks if the type change is supported by Iceberg V2 schema evolution.static booleanisWideningSupported(DataType sourceType, DataType targetType) Checks if a type change from sourceType to targetType is a supported widening operation.
-
Method Details
-
isWideningSupported
Checks if a type change from sourceType to targetType is a supported widening operation.- Parameters:
sourceType- The original data typetargetType- The target data type to widen to- Returns:
- true if the type change is a supported widening operation (or the types are equal), false otherwise
-
isIcebergV2Compatible
Checks if the type change is supported by Iceberg V2 schema evolution. This is required when Iceberg compatibility is enabled.- Parameters:
sourceType- The original data typetargetType- The target data type to widen to- Returns:
- true if the type change is supported by Iceberg V2 (sourceType == targetType returns true), false otherwise
-