Class TableFeatures

Object
io.delta.kernel.internal.tablefeatures.TableFeatures

public class TableFeatures extends Object
Contains utility methods related to the Delta table feature support in protocol.
  • Field Details

    • SET_TABLE_FEATURE_SUPPORTED_PREFIX

      public static String 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

      public static String SET_TABLE_FEATURE_SUPPORTED_VALUE
      Configuration value to turn on support for a table feature when used with SET_TABLE_FEATURE_SUPPORTED_PREFIX.

      Example: "delta.feature.myFeature" -> "supported"

    • APPEND_ONLY_W_FEATURE

      public static final TableFeature APPEND_ONLY_W_FEATURE
    • CATALOG_MANAGED_RW_FEATURE

      public static final TableFeature CATALOG_MANAGED_RW_FEATURE
    • INVARIANTS_W_FEATURE

      public static final TableFeature INVARIANTS_W_FEATURE
    • CONSTRAINTS_W_FEATURE

      public static final TableFeature CONSTRAINTS_W_FEATURE
    • CHANGE_DATA_FEED_W_FEATURE

      public static final TableFeature CHANGE_DATA_FEED_W_FEATURE
    • COLUMN_MAPPING_RW_FEATURE

      public static final TableFeature COLUMN_MAPPING_RW_FEATURE
    • GENERATED_COLUMNS_W_FEATURE

      public static final TableFeature GENERATED_COLUMNS_W_FEATURE
    • IDENTITY_COLUMNS_W_FEATURE

      public static final TableFeature IDENTITY_COLUMNS_W_FEATURE
    • VARIANT_RW_FEATURE

      public static final TableFeature VARIANT_RW_FEATURE
    • VARIANT_RW_PREVIEW_FEATURE

      public static final TableFeature VARIANT_RW_PREVIEW_FEATURE
    • VARIANT_SHREDDING_RW_FEATURE

      public static final TableFeature VARIANT_SHREDDING_RW_FEATURE
    • VARIANT_SHREDDING_PREVIEW_RW_FEATURE

      public static final TableFeature VARIANT_SHREDDING_PREVIEW_RW_FEATURE
    • DOMAIN_METADATA_W_FEATURE

      public static final TableFeature DOMAIN_METADATA_W_FEATURE
    • CLUSTERING_W_FEATURE

      public static final TableFeature CLUSTERING_W_FEATURE
    • ROW_TRACKING_W_FEATURE

      public static final TableFeature ROW_TRACKING_W_FEATURE
    • DELETION_VECTORS_RW_FEATURE

      public static final TableFeature DELETION_VECTORS_RW_FEATURE
    • ICEBERG_COMPAT_V2_W_FEATURE

      public static final TableFeature ICEBERG_COMPAT_V2_W_FEATURE
    • ICEBERG_COMPAT_V3_W_FEATURE

      public static final TableFeature ICEBERG_COMPAT_V3_W_FEATURE
    • TYPE_WIDENING_RW_FEATURE

      public static final TableFeature TYPE_WIDENING_RW_FEATURE
    • TYPE_WIDENING_RW_PREVIEW_FEATURE

      public static final TableFeature TYPE_WIDENING_RW_PREVIEW_FEATURE
    • IN_COMMIT_TIMESTAMP_W_FEATURE

      public static final TableFeature IN_COMMIT_TIMESTAMP_W_FEATURE
    • TIMESTAMP_NTZ_RW_FEATURE

      public static final TableFeature TIMESTAMP_NTZ_RW_FEATURE
    • CHECKPOINT_V2_RW_FEATURE

      public static final TableFeature CHECKPOINT_V2_RW_FEATURE
    • VACUUM_PROTOCOL_CHECK_RW_FEATURE

      public static final TableFeature VACUUM_PROTOCOL_CHECK_RW_FEATURE
    • CHECKPOINT_PROTECTION_W_FEATURE

      public static final TableFeature CHECKPOINT_PROTECTION_W_FEATURE
    • ALLOW_COLUMN_DEFAULTS_W_FEATURE

      public static final TableFeature 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

      public static final TableFeature ICEBERG_WRITER_COMPAT_V1
    • ICEBERG_WRITER_COMPAT_V3

      public static final TableFeature ICEBERG_WRITER_COMPAT_V3
    • MATERIALIZE_PARTITION_COLUMNS_W_FEATURE

      public static final TableFeature MATERIALIZE_PARTITION_COLUMNS_W_FEATURE
    • COLLATIONS_PREVIEW_W_FEATURE

      public static final TableFeature COLLATIONS_PREVIEW_W_FEATURE
      This feature was replaced with its stable version, `collations`.
    • COLLATIONS_W_FEATURE

      public static final TableFeature COLLATIONS_W_FEATURE
      The stable collation feature.
    • TABLE_FEATURES_MIN_READER_VERSION

      public static final int TABLE_FEATURES_MIN_READER_VERSION
      Min reader version that supports reader features.
      See Also:
    • TABLE_FEATURES_MIN_WRITER_VERSION

      public static final int TABLE_FEATURES_MIN_WRITER_VERSION
      Min reader version that supports writer features.
      See Also:
    • TABLE_FEATURES

      public static final List<TableFeature> TABLE_FEATURES
    • TABLE_FEATURE_MAP

      public static final Map<String,TableFeature> TABLE_FEATURE_MAP
  • Constructor Details

    • TableFeatures

      public TableFeatures()
  • Method Details

    • getTableFeature

      public static TableFeature getTableFeature(String featureName)
      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

      public static Tuple2<Integer,Integer> minimumRequiredVersions(Set<TableFeature> features)
      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 property delta.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

      public static void validateKernelCanReadTheTable(Protocol protocol, String tablePath)
      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

      public static boolean isCatalogManagedSupported(Protocol protocol)
    • isRowTrackingSupported

      public static boolean isRowTrackingSupported(Protocol protocol)
    • isDomainMetadataSupported

      public static boolean isDomainMetadataSupported(Protocol protocol)
    • isClusteringTableFeatureSupported

      public static boolean isClusteringTableFeatureSupported(Protocol protocol)
    • hasInvariants

      public static boolean hasInvariants(StructType tableSchema)
    • hasCheckConstraints

      public static boolean hasCheckConstraints(Metadata metadata)
    • hasIdentityColumns

      public static boolean hasIdentityColumns(Metadata metadata)
    • hasGeneratedColumns

      public static boolean hasGeneratedColumns(Metadata metadata)
    • hasGeospatial

      public static boolean hasGeospatial(Metadata metadata)