snazy commented on a change in pull request #4385:
URL: https://github.com/apache/iceberg/pull/4385#discussion_r834054060
##########
File path: nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
##########
@@ -281,46 +287,74 @@ public void renameTable(TableIdentifier from,
TableIdentifier toOriginal) {
// behavior. So better be safe than sorry.
}
- /**
- * creating namespaces in nessie is implicit, therefore this is a no-op.
Metadata is ignored.
- *
- * @param namespace a multi-part namespace
- * @param metadata a string Map of properties for the given namespace
- */
@Override
public void createNamespace(Namespace namespace, Map<String, String>
metadata) {
+ try {
Review comment:
Here (and dropNamespace below) a
```java
reference.checkMutable();
```
is missing. And after the creation/deletion of the namespace, `reference`
must be updated to point to the new HEAD.
##########
File path: nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
##########
@@ -281,46 +287,74 @@ public void renameTable(TableIdentifier from,
TableIdentifier toOriginal) {
// behavior. So better be safe than sorry.
}
- /**
- * creating namespaces in nessie is implicit, therefore this is a no-op.
Metadata is ignored.
- *
- * @param namespace a multi-part namespace
- * @param metadata a string Map of properties for the given namespace
- */
@Override
public void createNamespace(Namespace namespace, Map<String, String>
metadata) {
+ try {
+ api.createNamespace()
+ .refName(reference.getName())
Review comment:
Should be `.reference(reference)` (for all other occurences below as
well)
##########
File path: nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
##########
@@ -281,46 +287,74 @@ public void renameTable(TableIdentifier from,
TableIdentifier toOriginal) {
// behavior. So better be safe than sorry.
}
- /**
- * creating namespaces in nessie is implicit, therefore this is a no-op.
Metadata is ignored.
- *
- * @param namespace a multi-part namespace
- * @param metadata a string Map of properties for the given namespace
- */
@Override
public void createNamespace(Namespace namespace, Map<String, String>
metadata) {
+ try {
+ api.createNamespace()
+ .refName(reference.getName())
+ .namespace(org.projectnessie.model.Namespace.of(namespace.levels()))
+ .create();
+ } catch (NessieNamespaceAlreadyExistsException e) {
+ throw new AlreadyExistsException(e, "Namespace '%s' already exists.",
namespace);
+ } catch (NessieReferenceNotFoundException e) {
+ LOG.error("Cannot create Namespace '{}': ref is no longer valid.",
namespace, e);
Review comment:
Should actually be a RuntimeException and not a silent catch (even with
a log)
--
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]