haizhou-zhao commented on code in PR #6045:
URL: https://github.com/apache/iceberg/pull/6045#discussion_r1016941186
##########
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:
##########
@@ -518,11 +522,36 @@ private Map<String, String> convertToMetadata(Database
database) {
if (database.getDescription() != null) {
meta.put("comment", database.getDescription());
}
+ if (database.getOwnerName() != null) {
+ meta.put(TableProperties.HMS_DB_OWNER, database.getOwnerName());
+ if (database.getOwnerType() != null) {
+ meta.put(TableProperties.HMS_DB_OWNER_TYPE,
database.getOwnerType().name());
+ }
+ }
return meta;
}
Database convertToDatabase(Namespace namespace, Map<String, String> meta) {
+ Preconditions.checkArgument(
Review Comment:
I think Precondition are meant to check whether user/caller invoked the
method with the correct input/parameters.
Understandably, different sources will hold different opinions, but these
are the sources I found when I tried to google around:
Quoting these two java tutorial sites
https://www.geeksforgeeks.org/preconditions-guava-java/ &
https://www.baeldung.com/guava-preconditions
"The Preconditions Class provides a list of static methods for checking that
a method or a constructor is invoked with valid parameter values"
Quoting java doc for guava at
https://guava.dev/releases/19.0/api/docs/com/google/common/base/Preconditions.html
"Non-preconditions
It is of course possible to use the methods of this class to check for
invalid conditions which are not the caller's fault. Doing so is not
recommended because it is misleading to future readers of the code and of stack
traces. "
--
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]