szehon-ho commented on code in PR #6045:
URL: https://github.com/apache/iceberg/pull/6045#discussion_r1025370462
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -365,6 +374,13 @@ public boolean dropNamespace(Namespace namespace) {
@Override
public boolean setProperties(Namespace namespace, Map<String, String>
properties) {
+ Preconditions.checkArgument(
+ (properties.get(HMS_DB_OWNER_TYPE) == null) ==
(properties.get(HMS_DB_OWNER) == null),
+ "Setting "
Review Comment:
Nit: we usually use Preconditions with formatted strings, it makes it fit
more easily on one line ie, ("Setting %s and %s", ...)
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -518,11 +541,26 @@ private Map<String, String> convertToMetadata(Database
database) {
if (database.getDescription() != null) {
meta.put("comment", database.getDescription());
}
+ if (database.getOwnerName() != null) {
+ meta.put(HMS_DB_OWNER, database.getOwnerName());
+ if (database.getOwnerType() != null) {
+ meta.put(HMS_DB_OWNER_TYPE, database.getOwnerType().name());
+ }
+ }
return meta;
}
Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
+ Preconditions.checkArgument(
+ meta.get(HMS_DB_OWNER_TYPE) == null
Review Comment:
Optional: A bit related to previous comment, I actually think here there may
not be such a need for this extra bulky check, and call to a third party
library? If I'm not mistaken the valueOf anyway throws
IllegalArgumentException if it does not match a value, and it would be pretty
easy for user to find out?
not sure if it throws exception for nulls, if not we could do that I
suppose.
Just trying to reduce bulky code here if possible.
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -380,6 +396,13 @@ public boolean setProperties(Namespace namespace,
Map<String, String> properties
@Override
public boolean removeProperties(Namespace namespace, Set<String> properties)
{
+ Preconditions.checkArgument(
Review Comment:
same
--
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]