-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Hive encryption nits #14659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hive encryption nits #14659
Changes from 1 commit
8e980d5
a835b40
be2a7e5
a10b264
69c127a
b989d51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,8 +55,8 @@ | |
| import org.apache.iceberg.io.FileIO; | ||
| import org.apache.iceberg.io.LocationProvider; | ||
| import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Lists; | ||
| import org.apache.iceberg.relocated.com.google.common.collect.Maps; | ||
| import org.apache.iceberg.util.PropertyUtil; | ||
| import org.apache.thrift.TException; | ||
| import org.slf4j.Logger; | ||
|
|
@@ -148,13 +148,15 @@ public EncryptionManager encryption() { | |
| if (tableKeyId != null) { | ||
| if (keyManagementClient == null) { | ||
| throw new RuntimeException( | ||
| "Cant create encryption manager, because key management client is not set"); | ||
| "Cannot create encryption manager without a key management client"); | ||
| } | ||
|
|
||
| Map<String, String> encryptionProperties = Maps.newHashMap(); | ||
| encryptionProperties.put(TableProperties.ENCRYPTION_TABLE_KEY, tableKeyId); | ||
| encryptionProperties.put( | ||
| TableProperties.ENCRYPTION_DEK_LENGTH, String.valueOf(encryptionDekLength)); | ||
| Map<String, String> encryptionProperties = | ||
| ImmutableMap.of( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #13225, I felt like |
||
| TableProperties.ENCRYPTION_TABLE_KEY, | ||
| tableKeyId, | ||
| TableProperties.ENCRYPTION_DEK_LENGTH, | ||
| String.valueOf(encryptionDekLength)); | ||
|
|
||
| List<EncryptedKey> keys = Lists.newLinkedList(); | ||
| encryptedKeysFromMetadata.ifPresent(keys::addAll); | ||
|
|
@@ -321,7 +323,8 @@ 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( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This follows the discussion #13225 (comment). To me, |
||
| "Cannot remove encryption key ID from an encrypted table"); | ||
| } | ||
|
|
||
| HMSTablePropertyHelper.updateHmsTableForIcebergTable( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nit, matching the "Cannot" language used elsewhere. (Not strongly opinionated though)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could take this further with maybe:
However, this might be a bit premature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also throw a different exception class here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IllegalArgs or a Precondition prompting the key to be set sounds reasonable to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to use IllegalArgumentException or Preconditions check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks all, have made the change. You now get: