-
Notifications
You must be signed in to change notification settings - Fork 3k
Core: Fix test failure caused by check empty namespace on REST session catalog #11960
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
Core: Fix test failure caused by check empty namespace on REST session catalog #11960
Conversation
|
Hi @nastra , can you please take a look at this fix when available? Thanks a lot! |
| checkNamespaceIsValid(namespace); | ||
|
|
||
| try { | ||
| checkNamespaceIsValid(namespace); |
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.
can you please do the same for viewExists and tableExists?
--- a/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
+++ b/core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java
@@ -438,9 +438,9 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog
@Override
public boolean tableExists(SessionContext context, TableIdentifier identifier) {
Endpoint.check(endpoints, Endpoint.V1_TABLE_EXISTS);
- checkIdentifierIsValid(identifier);
try {
+ checkIdentifierIsValid(identifier);
client.head(paths.table(identifier), headers(context), ErrorHandlers.tableErrorHandler());
return true;
} catch (NoSuchTableException e) {
@@ -659,9 +659,9 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog
@Override
public boolean namespaceExists(SessionContext context, Namespace namespace) {
Endpoint.check(endpoints, Endpoint.V1_NAMESPACE_EXISTS);
- checkNamespaceIsValid(namespace);
try {
+ checkNamespaceIsValid(namespace);
client.head(
paths.namespace(namespace), headers(context), ErrorHandlers.namespaceErrorHandler());
return true;
@@ -1233,9 +1233,9 @@ public class RESTSessionCatalog extends BaseViewSessionCatalog
@Override
public boolean viewExists(SessionContext context, TableIdentifier identifier) {
Endpoint.check(endpoints, Endpoint.V1_VIEW_EXISTS);
- checkViewIdentifierIsValid(identifier);
try {
+ checkViewIdentifierIsValid(identifier);
client.head(paths.view(identifier), headers(context), ErrorHandlers.viewErrorHandler());
return true;
} catch (NoSuchViewException e) {
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.
Sure!
b2b4060 to
ba91203
Compare
nastra
left a comment
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 for fixing this @hantangwangd, LGTM
|
@nastra My pleasure! |
amogh-jahagirdar
left a comment
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.
Late +1 to this PR, noticed the issue last night. Thanks for the fix @hantangwangd!
This PR fix the failure test
RESTCompatibilityKitCatalogTests.listNamespacesWithEmptyNamespace()running based onRESTSessionCatalog.In the original implementation, for empty namespaces,
RESTSessionCatalog.namespaceExists()would directly throw anNoSuchNamespaceExceptionrather than returning false. This will lead to the failure of the test.