Skip to content
Merged
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 @@ -321,7 +321,14 @@ protected void doCommit(TableMetadata base, TableMetadata metadata) {
}

if (removedProps.contains(TableProperties.ENCRYPTION_TABLE_KEY)) {
throw new RuntimeException("Cannot remove key in encrypted table");
throw new IllegalArgumentException("Cannot remove key in encrypted table");
}

if (base != null
&& !Objects.equals(
base.properties().get(TableProperties.ENCRYPTION_TABLE_KEY),
metadata.properties().get(TableProperties.ENCRYPTION_TABLE_KEY))) {
Comment on lines +329 to +330
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC, this now means table REPLACEs must have the same key property as before (+ you can't add a key when you replace).

Makes sense to me. WDYT about adding a test case to document that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will appreciated if you'd add it in 14659 or 13225.

Copy link
Contributor

Choose a reason for hiding this comment

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

throw new IllegalArgumentException("Cannot modify key in encrypted table");
}

HMSTablePropertyHelper.updateHmsTableForIcebergTable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ public void testKeyDelete() {
.hasMessageContaining("Cannot remove key in encrypted table");
}

@TestTemplate
public void testKeyAlter() {
assertThatThrownBy(
() -> sql("ALTER TABLE %s SET TBLPROPERTIES ('encryption.key-id'='abcd')", tableName))
.hasMessageContaining("Cannot modify key in encrypted table");
}

@TestTemplate
public void testDirectDataFileRead() {
List<Object[]> dataFileTable =
Expand Down