Class TableFeatures
Object
io.delta.kernel.internal.tablefeatures.TableFeatures
Contains utility methods related to the Delta table feature support in protocol.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TableFeatureSupport reading / metadata writes on tables with the feature.static final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeatureThis feature was replaced with its stable version, `collations`.static final TableFeatureThe stable collation feature.static final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic StringThe prefix for setting an override of a feature option in Metadata configuration.static StringConfiguration value to turn on support for a table feature when used withSET_TABLE_FEATURE_SUPPORTED_PREFIX.static final Map<String, TableFeature> static final List<TableFeature> static final intMin reader version that supports reader features.static final intMin reader version that supports writer features.static final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeaturestatic final TableFeature -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<Tuple2<Protocol, Set<TableFeature>>> autoUpgradeProtocolBasedOnMetadata(Metadata newMetadata, Collection<TableFeature> manuallyEnabledFeatures, Protocol currentProtocol) Upgrade the current protocol to satisfy all auto-update capable features required by the given metadata.static Tuple2<Set<TableFeature>, Optional<Metadata>> extractFeaturePropertyOverrides(Metadata currentMetadata) Extracts features overrides from Metadata properties and returns an updated metadata if any overrides are present.static TableFeaturegetTableFeature(String featureName) Get the table feature by name.static booleanhasCheckConstraints(Metadata metadata) static booleanhasGeneratedColumns(Metadata metadata) static booleanhasGeospatial(Metadata metadata) static booleanhasIdentityColumns(Metadata metadata) static booleanhasInvariants(StructType tableSchema) static booleanisCatalogManagedSupported(Protocol protocol) static booleanisClusteringTableFeatureSupported(Protocol protocol) static booleanisDomainMetadataSupported(Protocol protocol) static booleanisPropertiesManuallySupportingTableFeature(Map<String, String> userProperties, TableFeature tableFeature) Checks if a table feature is being manually supported through user propertydelta.feature.<featureName>=supported.static booleanisRowTrackingSupported(Protocol protocol) minimumRequiredVersions(Set<TableFeature> features) Returns the minimum reader/writer versions required to support all provided features.static booleansupportsReaderFeatures(int minReaderVersion) Does reader version supports explicitly specifying reader feature set in protocol?static booleansupportsWriterFeatures(int minWriterVersion) Does writer version supports explicitly specifying writer feature set in protocol?static voidvalidateKernelCanReadTheTable(Protocol protocol, String tablePath) Utility method to check if the table with given protocol is readable by the Kernel.static voidvalidateKernelCanWriteToTable(Protocol protocol, Metadata metadata, String tablePath) Utility method to check if the table with given protocol and metadata is writable by the Kernel.
-
Field Details
-
SET_TABLE_FEATURE_SUPPORTED_PREFIX
The prefix for setting an override of a feature option in Metadata configuration.Keys with this prefix should never be persisted in the Metadata action. The keys can be filtered out by using extractFeaturePropertyOverrides(io.delta.kernel.internal.actions.Metadata).
These overrides only support add the feature as supported in the Protocol action.
Disabling features via this method is unsupported.
-
SET_TABLE_FEATURE_SUPPORTED_VALUE
Configuration value to turn on support for a table feature when used withSET_TABLE_FEATURE_SUPPORTED_PREFIX.Example:
"delta.feature.myFeature" -> "supported" -
APPEND_ONLY_W_FEATURE
-
CATALOG_MANAGED_RW_FEATURE
-
INVARIANTS_W_FEATURE
-
CONSTRAINTS_W_FEATURE
-
CHANGE_DATA_FEED_W_FEATURE
-
COLUMN_MAPPING_RW_FEATURE
-
GENERATED_COLUMNS_W_FEATURE
-
IDENTITY_COLUMNS_W_FEATURE
-
VARIANT_RW_FEATURE
-
VARIANT_RW_PREVIEW_FEATURE
-
VARIANT_SHREDDING_RW_FEATURE
-
VARIANT_SHREDDING_PREVIEW_RW_FEATURE
-
DOMAIN_METADATA_W_FEATURE
-
CLUSTERING_W_FEATURE
-
ROW_TRACKING_W_FEATURE
-
DELETION_VECTORS_RW_FEATURE
-
ICEBERG_COMPAT_V2_W_FEATURE
-
ICEBERG_COMPAT_V3_W_FEATURE
-
TYPE_WIDENING_RW_FEATURE
-
TYPE_WIDENING_RW_PREVIEW_FEATURE
-
IN_COMMIT_TIMESTAMP_W_FEATURE
-
TIMESTAMP_NTZ_RW_FEATURE
-
CHECKPOINT_V2_RW_FEATURE
-
VACUUM_PROTOCOL_CHECK_RW_FEATURE
-
CHECKPOINT_PROTECTION_W_FEATURE
-
ALLOW_COLUMN_DEFAULTS_W_FEATURE
Support reading / metadata writes on tables with the feature. Don't support writing new data rows with default values. Don't allow updating the types of columns with default values. -
ICEBERG_WRITER_COMPAT_V1
-
ICEBERG_WRITER_COMPAT_V3
-
MATERIALIZE_PARTITION_COLUMNS_W_FEATURE
-
COLLATIONS_PREVIEW_W_FEATURE
This feature was replaced with its stable version, `collations`. -
COLLATIONS_W_FEATURE
The stable collation feature. -
TABLE_FEATURES_MIN_READER_VERSION
public static final int TABLE_FEATURES_MIN_READER_VERSIONMin reader version that supports reader features.- See Also:
-
TABLE_FEATURES_MIN_WRITER_VERSION
public static final int TABLE_FEATURES_MIN_WRITER_VERSIONMin reader version that supports writer features.- See Also:
-
TABLE_FEATURES
-
TABLE_FEATURE_MAP
-
-
Constructor Details
-
TableFeatures
public TableFeatures()
-
-
Method Details
-
getTableFeature
Get the table feature by name. Case-insensitive lookup. If not found, throws error. -
supportsReaderFeatures
public static boolean supportsReaderFeatures(int minReaderVersion) Does reader version supports explicitly specifying reader feature set in protocol? -
supportsWriterFeatures
public static boolean supportsWriterFeatures(int minWriterVersion) Does writer version supports explicitly specifying writer feature set in protocol? -
minimumRequiredVersions
Returns the minimum reader/writer versions required to support all provided features. -
autoUpgradeProtocolBasedOnMetadata
public static Optional<Tuple2<Protocol,Set<TableFeature>>> autoUpgradeProtocolBasedOnMetadata(Metadata newMetadata, Collection<TableFeature> manuallyEnabledFeatures, Protocol currentProtocol) Upgrade the current protocol to satisfy all auto-update capable features required by the given metadata. If the current protocol already satisfies the metadata requirements, return empty.- Parameters:
newMetadata- the new metadata to be applied to the table.manuallyEnabledFeatures- features that were requested to be added to the protocol.currentProtocol- the current protocol of the table.- Returns:
- the upgraded protocol and the set of new features that were enabled in the upgrade.
-
isPropertiesManuallySupportingTableFeature
public static boolean isPropertiesManuallySupportingTableFeature(Map<String, String> userProperties, TableFeature tableFeature) Checks if a table feature is being manually supported through user propertydelta.feature.<featureName>=supported. -
extractFeaturePropertyOverrides
public static Tuple2<Set<TableFeature>,Optional<Metadata>> extractFeaturePropertyOverrides(Metadata currentMetadata) Extracts features overrides from Metadata properties and returns an updated metadata if any overrides are present.Overrides are specified using a key in th form SET_TABLE_FEATURE_SUPPORTED_PREFIX + {featureName}. (e.g.
delta.feature.icebergWriterCompatV1). The value must be "supported" to add the feature. Currently, removing values is not handled.- Returns:
- A set of features that had overrides and Metadata object with the properties removed if any overrides were present.
- Throws:
KernelException- if the feature name for the override is invalid or the value is not equal to "supported".
-
validateKernelCanReadTheTable
Utility method to check if the table with given protocol is readable by the Kernel. -
validateKernelCanWriteToTable
public static void validateKernelCanWriteToTable(Protocol protocol, Metadata metadata, String tablePath) Utility method to check if the table with given protocol and metadata is writable by the Kernel. -
isCatalogManagedSupported
-
isRowTrackingSupported
-
isDomainMetadataSupported
-
isClusteringTableFeatureSupported
-
hasInvariants
-
hasCheckConstraints
-
hasIdentityColumns
-
hasGeneratedColumns
-
hasGeospatial
-