smaheshwar-pltr commented on code in PR #19004:
URL: https://github.com/apache/iceberg/pull/19004#discussion_r4815422117


##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java:
##########
@@ -305,6 +305,12 @@ protected void doCommit(TableMetadata base, TableMetadata 
metadata) {
             !removedProps.contains(TableProperties.ENCRYPTION_TABLE_KEY),
             "Cannot remove key ID from an encrypted table");
 
+        Preconditions.checkArgument(
+            base.properties().containsKey(TableProperties.ENCRYPTION_TABLE_KEY)
+                || 
!metadata.properties().containsKey(TableProperties.ENCRYPTION_TABLE_KEY),
+            "Cannot add key ID to an existing table: set %s when creating the 
table",

Review Comment:
   Actually I realised "when creating the table" is a bit misleading if the 
user ran a `CREATE OR REPLACE` and runs into this, so I've now gone with your 
suggestion 👍 



-- 
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]

Reply via email to