-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Nessie: Support APIv2 client #22215
Nessie: Support APIv2 client #22215
Conversation
cc: @dimas-b |
icebergNessieCatalogConfig.getDefaultReferenceName(), | ||
null, | ||
ImmutableMap.of()); | ||
} | ||
|
||
private static String inferVersionFromURI(String uri) |
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.
Ideally we should have exposed this from Iceberg repo
https://github.com/apache/iceberg/blob/2722290a7793dcb4f411aad271d5a22697c696f9/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java#L136
But that needs another release (1.6.0, which may take a while)
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.
Return ClientApiVersion.forName()
. This will throw if the API is unknown
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.
Didn't use ClientApiVersion.valueOf()
but returning the ClientApiVersion
from inferVersionFromURI
7fb292a
to
a12a160
Compare
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 improvement. LGTM. Thanks, @ajantha-bhat !
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogConfig.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
Test failure is because of existing unrelated flaky test: #18697 |
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
The failure in |
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.
LGTM % comments
@@ -58,9 +63,46 @@ public static NessieIcebergClient createNessieIcebergClient(IcebergNessieCatalog | |||
icebergNessieCatalogConfig.getBearerToken() | |||
.ifPresent(token -> builder.withAuthentication(BearerAuthenticationProvider.create(token))); | |||
|
|||
return new NessieIcebergClient(builder.build(NessieApiV1.class), | |||
// default version is inferred by uri. | |||
IcebergNessieCatalogConfig.ClientApiVersion apiVersion = icebergNessieCatalogConfig.getClientAPIVersion() |
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.
let's push this logic to IcebergNessieCatalogConfig so that getClientAPIVersion always return a ClientApiVersion
:
public ClientApiVersion getClientAPIVersion()
{
return clientAPIVersion.orElseGet(this::inferVersionFromURI);
}
Move inferVersionFromURI
to IcebergNessieCatalogConfig
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.
TestIcebergNessieCatalogConfig.testExplicitPropertyMapping
is failing because assertAttributesNotEqual(metadata, actual, defaultInstance);
will try to get the getClientAPIVersion()
using getter method of the default instance (without URI and get the exception).
I think clubbing inferVersionFromURI
in the getter is not a good idea. I am planning to call it separately but still keep the inferVersionFromURI
method in this class as protected method.
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
...iceberg/src/main/java/io/trino/plugin/iceberg/catalog/nessie/IcebergNessieCatalogModule.java
Outdated
Show resolved
Hide resolved
@@ -566,12 +566,15 @@ properties: | |||
* - `iceberg.nessie-catalog.authentication.token` | |||
- The token to use with `BEARER` authentication. Example: | |||
`SXVLUXUhIExFQ0tFUiEK` | |||
* - `iceberg.nessie-catalog.client-api-version` | |||
- Optional client api version to be used instead of inferring from server URI. | |||
Available value is `V1` or `V2`. |
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.
Available values are
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.
@mosabua ptal for documentation changes
@@ -566,12 +566,15 @@ properties: | |||
* - `iceberg.nessie-catalog.authentication.token` | |||
- The token to use with `BEARER` authentication. Example: | |||
`SXVLUXUhIExFQ0tFUiEK` | |||
* - `iceberg.nessie-catalog.client-api-version` | |||
- Optional client api version to be used instead of inferring from server URI. |
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.
Client API version to be used. By default API version is inferred from the iceberg.nessie-catalog.uri
} | ||
|
||
@Config("iceberg.nessie-catalog.client-api-version") | ||
@ConfigDescription("Optional client api version to be used instead of inferring from server URI") |
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.
Client API version to use
@@ -566,12 +566,15 @@ properties: | |||
* - `iceberg.nessie-catalog.authentication.token` | |||
- The token to use with `BEARER` authentication. Example: | |||
`SXVLUXUhIExFQ0tFUiEK` | |||
* - `iceberg.nessie-catalog.client-api-version` | |||
- Client API version to be used. By default API version is inferred from the `iceberg.nessie-catalog.uri`. |
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.
- Client API version to be used. By default API version is inferred from the `iceberg.nessie-catalog.uri`. | |
- Optional version of the Client API version to use. By default it is inferred from the `iceberg.nessie-catalog.uri` value. |
@@ -566,12 +566,15 @@ properties: | |||
* - `iceberg.nessie-catalog.authentication.token` | |||
- The token to use with `BEARER` authentication. Example: | |||
`SXVLUXUhIExFQ0tFUiEK` | |||
* - `iceberg.nessie-catalog.client-api-version` | |||
- Client API version to be used. By default API version is inferred from the `iceberg.nessie-catalog.uri`. | |||
Available values are `V1` or `V2`. |
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.
Available values are `V1` or `V2`. | |
Valid values are `V1` or `V2`. |
By default, Nessie API version will be inferred from Nessie URI. If the User has a custom URI which doesn't have version info in the URI, user can configure `iceberg.nessie-catalog.client-api-version`
@findepi can we use api/v2 now? for Iceberg connector
Is it possible to change catalog.uri to http://10.163.20.222:32327/api/v2?
|
@JunseoChoJJ: Once the next version of Trino is released, we can use it. |
@ajantha-bhat I used trino 449 |
upcoming release (450) will have this change. |
Description
By default, Nessie API version will be inferred from Nessie URI. If the User has a custom URI which doesn't have version info in the URI, user can configure
iceberg.nessie-catalog.client-api-version
Additional context and related issues
Changes at Iceberg repo: apache/iceberg#9459
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( x) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: