Skip to content

Commit dd5e30d

Browse files
committed
respond to pr comments
1 parent c544be5 commit dd5e30d

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

kernel/kernel-api/src/main/java/io/delta/kernel/internal/ReplaceTableTransactionBuilderV2Impl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ public class ReplaceTableTransactionBuilderV2Impl implements ReplaceTableTransac
3939
new HashSet<String>() {
4040
{
4141
add(TableConfig.COLUMN_MAPPING_MAX_COLUMN_ID.getKey());
42+
43+
// Must retail all ICT properties, else a client would not know when ICT was enabled,
44+
// which could result in a failed query or incorrect results.
4245
add(TableConfig.IN_COMMIT_TIMESTAMPS_ENABLED.getKey());
43-
// TODO are there any other table properties we should preserve?
46+
add(TableConfig.IN_COMMIT_TIMESTAMP_ENABLEMENT_VERSION.getKey());
47+
add(TableConfig.IN_COMMIT_TIMESTAMP_ENABLEMENT_TIMESTAMP.getKey());
4448
}
4549
};
4650

kernel/kernel-api/src/main/java/io/delta/kernel/internal/TransactionMetadataFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,11 @@ private static void validateSchemaAndPartColsCreateOrReplace(
661661
}
662662

663663
private static void validateNotEnablingCatalogManagedOnReplace(
664-
Map<String, String> tableProperties) {
664+
Map<String, String> userInputTableProperties) {
665665
if (TableFeatures.isPropertiesManuallySupportingTableFeature(
666-
tableProperties, TableFeatures.CATALOG_MANAGED_R_W_FEATURE_PREVIEW)) {
666+
userInputTableProperties, TableFeatures.CATALOG_MANAGED_R_W_FEATURE_PREVIEW)) {
667667
throw new UnsupportedOperationException(
668-
"Cannot enable the catalogManaged feature during a REPLACE operation.");
668+
"Cannot enable the catalogManaged feature during a REPLACE command.");
669669
}
670670
}
671671
}

kernel/kernel-api/src/main/java/io/delta/kernel/internal/tablefeatures/TableFeatures.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ public class TableFeatures {
5050
*/
5151
public static String SET_TABLE_FEATURE_SUPPORTED_PREFIX = "delta.feature.";
5252

53+
/**
54+
* Configuration value to turn on support for a table feature when used with {@link
55+
* #SET_TABLE_FEATURE_SUPPORTED_PREFIX}.
56+
*
57+
* <p>Example: {@code "delta.feature.myFeature" -> "supported"}
58+
*/
59+
public static String SET_TABLE_FEATURE_SUPPORTED_VALUE = "supported";
60+
5361
/////////////////////////////////////////////////////////////////////////////////
5462
/// START: Define the {@link TableFeature}s ///
5563
/// If feature instance variable ends with ///
@@ -615,7 +623,7 @@ public static boolean isPropertiesManuallySupportingTableFeature(
615623
Map<String, String> userProperties, TableFeature tableFeature) {
616624
final String featurePropKey = SET_TABLE_FEATURE_SUPPORTED_PREFIX + tableFeature.featureName();
617625
final String propertyValue = userProperties.get(featurePropKey); // will be null if not found
618-
return "supported".equals(propertyValue);
626+
return SET_TABLE_FEATURE_SUPPORTED_VALUE.equals(propertyValue);
619627
}
620628

621629
/**
@@ -642,7 +650,7 @@ public static Tuple2<Set<TableFeature>, Optional<Metadata>> extractFeatureProper
642650

643651
TableFeature feature = getTableFeature(featureName);
644652
features.add(feature);
645-
if (!entry.getValue().equals("supported")) {
653+
if (!entry.getValue().equals(SET_TABLE_FEATURE_SUPPORTED_VALUE)) {
646654
throw DeltaErrors.invalidConfigurationValueException(
647655
entry.getKey(),
648656
entry.getValue(),

kernel/kernel-defaults/src/test/scala/io/delta/kernel/defaults/catalogManaged/CatalogManagedEnablementSuite.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
139139
.commit(defaultEngine, emptyIterable[Row])
140140
}
141141

142-
// CreateTableTransactionBuilder and UpdateTableTransactionBuilder don't share a common
143-
// parent interface. So, we treat the `txnBuilder` as a trait that has a `build(engine)`
144-
// method. Scalastyle doesn't like this, but it's valid.
142+
// CREATE, UPDATE, and REPLACE txnBuilders don't share a common parent interface. So, we
143+
// treat the `txnBuilder` as a trait that has a `build(engine)` method. Scalastyle doesn't
144+
// like this, but it's valid.
145145
//
146146
// scalastyle:off
147147
val txnBuilder: { def build(engine: Engine): Transaction } = testCase.operationType match {
@@ -164,7 +164,7 @@ class CatalogManagedEnablementSuite extends AnyFunSuite with TestUtils {
164164

165165
TableManager
166166
.loadSnapshot(tablePath)
167-
.withCommitter(committer)
167+
.withCommitter(committerUsingPutIfAbsent)
168168
.build(defaultEngine)
169169
.asInstanceOf[SnapshotImpl]
170170
.buildReplaceTableTransaction(replaceSchema, "engineInfo")

0 commit comments

Comments
 (0)