adutra commented on PR #12901:
URL: https://github.com/apache/iceberg/pull/12901#issuecomment-2872884394
> This currently returns an empty list instead of throwing a NSNE
Ah! In this case I think we need another API call. Try this:
```java
public List<Namespace> listNamespaces(Namespace namespace) throws
NoSuchNamespaceException {
try {
org.projectnessie.model.Namespace root =
org.projectnessie.model.Namespace.of(namespace.levels());
if (!namespace.isEmpty()) {
Content existing =
api.getContent()
.reference(getReference())
.key(root.toContentKey())
.get()
.get(root.toContentKey());
if (existing == null) {
throw new NoSuchNamespaceException("Namespace %s does not exist!",
namespace);
}
}
String filter = "entry.contentType == 'NAMESPACE' && ";
// etc
```
Then the below assertions should pass:
```java
client.createNamespace(Namespace.of("a"), Map.of());
assertThat(client.listNamespaces(Namespace.empty())).containsOnly(Namespace.of("a"));
assertThat(client.listNamespaces(Namespace.of("a"))).isEmpty();
assertThatThrownBy(() ->
client.listNamespaces(Namespace.of("non-existing"))).isInstanceOf(NoSuchNamespaceException.class);
```
--
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]