Hugo-WB commented on code in PR #16353:
URL: https://github.com/apache/iceberg/pull/16353#discussion_r3589279280
##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/sql/TestTableEncryption.java:
##########
@@ -222,6 +225,50 @@ public void testInsertAndDelete() {
sql("SELECT * FROM %s ORDER BY id", tableName));
}
+ @TestTemplate
+ public void testExpireSnapshotsRemovesEncryptionKeys() {
+ sql("INSERT INTO %s VALUES (4, 'd', 4.0)", tableName);
+
+ validationCatalog.initialize(catalogName, catalogConfig);
+ Table table = validationCatalog.loadTable(tableIdent);
+
+ Snapshot current = table.currentSnapshot();
+
+ Snapshot snapshotToExpire =
+ Streams.stream(table.snapshots())
+ .filter(snapshot -> snapshot.parentId() == null)
+ .findFirst()
+ .orElseThrow(() -> new IllegalStateException("Expected a root
snapshot"));
+
+ assertThat(((HasTableOperations)
table).operations().current().encryptionKeys())
+ .as("Encryption key for snapshotToExpire is in metadata before
expiry.")
+ .extracting(EncryptedKey::keyId)
+ .contains(snapshotToExpire.keyId(), current.keyId());
+
+ SparkActions.get()
+ .expireSnapshots(table)
+ .expireSnapshotId(snapshotToExpire.snapshotId())
+ .execute();
Review Comment:
Updated!
https://github.com/apache/iceberg/pull/16353/changes/082d3f923cc6cbb24eaf61dda63c4ba5866d2872
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]