-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29036: Support ViewCatalog through Iceberg REST API #5888
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
Conversation
62c44fb
to
59fa33f
Compare
catalog instanceof SupportsNamespaces ? (SupportsNamespaces) catalog : null; | ||
this.asViewCatalog = catalog instanceof ViewCatalog ? (ViewCatalog) catalog : null; | ||
this.asNamespaceCatalog = (SupportsNamespaces) catalog; | ||
this.asViewCatalog = (ViewCatalog) catalog; |
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.
I believe our adapter does not need to be so generic
RENAME_VIEW(HTTPMethod.POST, "v1/views/rename", | ||
RenameTableRequest.class, null), | ||
DROP_VIEW(HTTPMethod.DELETE, VIEWS_PATH); | ||
TOKENS(HTTPMethod.POST, "v1/oauth/tokens", null), |
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.
I copied & pasted 1.9.1 of the upstream and removed unused fields. When our /v1/config
returns the list of endpoints, the original form, such as v1/namespaces
, doesn't work. We need to be adaptable to the new form such as /v1/{prefix}/namespaces
.
https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/rest/ResourcePaths.java
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.
what is the role of {prefix}
- catalogName aka iceberg
?
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.
It is an optional path parameter, which we can freely use.
apache/iceberg#5233
S3 Tables use it to put a bucket identifier.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-integrating-open-source.html#endpoint-parameter
I guess multi-tenant services utilize it, but I've not used it so far.
return castResponse(ConfigResponse.class, ConfigResponse.builder().build()); | ||
final List<Endpoint> endpoints = Arrays.stream(Route.values()) | ||
.map(r -> Endpoint.create(r.method.name(), r.resourcePath)).collect(Collectors.toList()); | ||
return castResponse(ConfigResponse.class, ConfigResponse.builder().withEndpoints(endpoints).build()); |
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.
This change is one of the key points of this PR. The Iceberg client doesn't support views unless we explicitly declare that we support view endpoints.
#5887 (comment)
59fa33f
to
585eebb
Compare
catalog instanceof SupportsNamespaces ? (SupportsNamespaces) catalog : null; | ||
this.asViewCatalog = catalog instanceof ViewCatalog ? (ViewCatalog) catalog : null; | ||
this.asNamespaceCatalog = (SupportsNamespaces) catalog; | ||
this.asViewCatalog = (ViewCatalog) catalog; | ||
} | ||
|
||
enum HTTPMethod { |
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.
@okumin, could you please drop this enum and import org.apache.iceberg.rest.HTTPRequest.HTTPMethod
?
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.
nice advice
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.
+1
|
What changes were proposed in this pull request?
Add the view support with integration tests.
https://issues.apache.org/jira/browse/HIVE-29036
Why are the changes needed?
With the current configuration, the Iceberg client ignores view-related endpoints.
Does this PR introduce any user-facing change?
No. REST Catalog has not been released yet.
How was this patch tested?