Skip to content

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

Merged
merged 2 commits into from
Jun 26, 2025

Conversation

okumin
Copy link
Contributor

@okumin okumin commented Jun 23, 2025

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?

mvn clean test -pl metastore-rest-catalog

catalog instanceof SupportsNamespaces ? (SupportsNamespaces) catalog : null;
this.asViewCatalog = catalog instanceof ViewCatalog ? (ViewCatalog) catalog : null;
this.asNamespaceCatalog = (SupportsNamespaces) catalog;
this.asViewCatalog = (ViewCatalog) catalog;
Copy link
Contributor Author

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),
Copy link
Contributor Author

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

Copy link
Member

@deniskuzZ deniskuzZ Jun 24, 2025

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?

Copy link
Contributor Author

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

Glue.
https://docs.aws.amazon.com/glue/latest/dg/connect-glu-iceberg-rest.html#prefix-catalog-path-parameters

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());
Copy link
Contributor Author

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)

@okumin okumin changed the title [WIP] HIVE-29036: Support ViewCatalog through Iceberg REST API HIVE-29036: Support ViewCatalog through Iceberg REST API Jun 23, 2025
@okumin okumin marked this pull request as ready for review June 23, 2025 10:56
catalog instanceof SupportsNamespaces ? (SupportsNamespaces) catalog : null;
this.asViewCatalog = catalog instanceof ViewCatalog ? (ViewCatalog) catalog : null;
this.asNamespaceCatalog = (SupportsNamespaces) catalog;
this.asViewCatalog = (ViewCatalog) catalog;
}

enum HTTPMethod {
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice advice

Copy link
Member

@deniskuzZ deniskuzZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link

@deniskuzZ deniskuzZ merged commit 0fd1cee into apache:master Jun 26, 2025
4 checks passed
@okumin okumin deleted the HIVE-29036-rest-view branch June 26, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants