Skip to content

Commit

Permalink
WIP: Test Upcoming Iceberg and Nessie versions
Browse files Browse the repository at this point in the history
- Testing with Iceberg 1.5.0 RC4 and Nessie 0.77.1
- Remove deprecated usage
- InputFile.length is being called since apache/iceberg#9592
- Handle JDBC catalog test failures

Co-authored-by: Eduard Tudenhoefner <[email protected]>
  • Loading branch information
ajantha-bhat and nastra committed Mar 3, 2024
1 parent 35f4084 commit 20762c9
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 25 deletions.
24 changes: 22 additions & 2 deletions plugin/trino-iceberg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
<!-- Nessie version (matching to Iceberg release) must be bumped along with Iceberg version bump to avoid compatibility issues -->
<dep.nessie.version>0.71.1</dep.nessie.version>
<dep.nessie.version>0.77.1</dep.nessie.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -239,12 +239,32 @@
<groupId>org.projectnessie.nessie</groupId>
<artifactId>nessie-client</artifactId>
<version>${dep.nessie.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.projectnessie.nessie</groupId>
<artifactId>nessie-model</artifactId>
<version>${dep.nessie.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -332,7 +352,7 @@
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.2.3</version>
<version>5.3.1</version>
<scope>runtime</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import io.trino.plugin.iceberg.catalog.IcebergTableOperationsProvider;
import io.trino.plugin.iceberg.catalog.TrinoCatalogFactory;
import org.apache.iceberg.nessie.NessieIcebergClient;
import org.projectnessie.client.NessieClientBuilder;
import org.projectnessie.client.api.NessieApiV1;
import org.projectnessie.client.auth.BearerAuthenticationProvider;
import org.projectnessie.client.http.HttpClientBuilder;

import static io.airlift.configuration.ConfigBinder.configBinder;
import static java.lang.Math.toIntExact;
Expand All @@ -47,7 +47,7 @@ protected void setup(Binder binder)
@Singleton
public static NessieIcebergClient createNessieIcebergClient(IcebergNessieCatalogConfig icebergNessieCatalogConfig)
{
HttpClientBuilder builder = HttpClientBuilder.builder()
NessieClientBuilder builder = NessieClientBuilder.createClientBuilderFromSystemSettings()
.withUri(icebergNessieCatalogConfig.getServerUri())
.withDisableCompression(!icebergNessieCatalogConfig.isCompressionEnabled())
.withReadTimeout(toIntExact(icebergNessieCatalogConfig.getReadTimeout().toMillis()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ protected void commitNewTable(TableMetadata metadata)
{
verify(version.isEmpty(), "commitNewTable called on a table which already exists");
try {
nessieClient.commitTable(null, metadata, writeNewMetadata(metadata, 0), table, toKey(new SchemaTableName(database, this.tableName)));
String contentId = table == null ? null : table.getId();
nessieClient.commitTable(null, metadata, writeNewMetadata(metadata, 0), contentId,
toKey(new SchemaTableName(database, this.tableName)));
}
catch (NessieNotFoundException e) {
throw new TrinoException(ICEBERG_COMMIT_ERROR, format("Cannot commit: ref '%s' no longer exists", nessieClient.refName()), e);
Expand All @@ -126,7 +128,11 @@ protected void commitToExistingTable(TableMetadata base, TableMetadata metadata)
{
verify(version.orElseThrow() >= 0, "commitToExistingTable called on a new table");
try {
nessieClient.commitTable(base, metadata, writeNewMetadata(metadata, version.getAsInt() + 1), table, toKey(new SchemaTableName(database, this.tableName)));
if (table == null) {
table = nessieClient.table(toIdentifier(new SchemaTableName(database, tableName)));
}
nessieClient.commitTable(base, metadata, writeNewMetadata(metadata, version.getAsInt() + 1), table.getId(),
toKey(new SchemaTableName(database, this.tableName)));
}
catch (NessieNotFoundException e) {
throw new TrinoException(ICEBERG_COMMIT_ERROR, format("Cannot commit: ref '%s' no longer exists", nessieClient.refName()), e);
Expand Down
Loading

0 comments on commit 20762c9

Please sign in to comment.