Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ trait DeltaConfigsBase extends DeltaLogging {
kv
case lKey if lKey.startsWith(TableFeatureProtocolUtils.FEATURE_PROP_PREFIX) =>
// This is a table feature, we should allow it.
lKey -> value
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lKey is the lower case. changing it to key to retain the original case.

key -> value
case lKey if lKey.startsWith("delta.") =>
Option(entries.get(lKey.stripPrefix("delta."))) match {
case Some(deltaConfig) if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ object TableFeatureProtocolUtils {
/** Min reader version that supports writer features. */
val TABLE_FEATURES_MIN_WRITER_VERSION = 7

/** The table ID property key needed by feature catalogManaged. */
val UC_TABLE_ID_KEY = "io.unitycatalog.tableId"

/** Get the table property config key for the `feature`. */
def propertyKey(feature: TableFeature): String = propertyKey(feature.name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.apache.spark.sql.catalyst.SQLConfHelper
import org.apache.spark.sql.catalyst.catalog.{CatalogTable, CatalogTableType}
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.connector.catalog.Identifier
import org.apache.spark.sql.delta.actions.TableFeatureProtocolUtils
import org.apache.spark.sql.types.StructType

/**
Expand Down Expand Up @@ -130,6 +131,12 @@ trait CreateDeltaTableLike extends SQLConfHelper {
} else {
table.storage.copy(properties = Map.empty)
}
// These table protocol properties, along with the uc table id, are needed when the create table
// request is sent to server.
val tableProtocolProperties = table.properties.view.filterKeys { k =>
TableFeatureProtocolUtils.isTableProtocolProperty(k) ||
k == TableFeatureProtocolUtils.UC_TABLE_ID_KEY
}

// If we have to update the catalog, use the correct schema and table properties, otherwise
// empty out the schema and property information
Expand All @@ -149,13 +156,13 @@ trait CreateDeltaTableLike extends SQLConfHelper {
// we store the partition columns as regular data columns.
partitionColumnNames = Nil,
properties = UpdateCatalog.updatedProperties(snapshot)
++ additionalProperties,
++ additionalProperties ++ tableProtocolProperties,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be conservative, adding back just the protocol properties plus the uc table id.

storage = storageProps,
tracksPartitionsInCatalog = true)
} else {
table.copy(
schema = new StructType(),
properties = Map.empty,
properties = tableProtocolProperties.toMap,
partitionColumnNames = Nil,
// Remove write specific options when updating the catalog
storage = storageProps,
Expand Down
Loading