From effdc86080e72efce890deb25bc569cb3509efa3 Mon Sep 17 00:00:00 2001 From: ajantha-bhat Date: Tue, 11 Apr 2023 20:02:50 +0530 Subject: [PATCH 1/2] Nessie: Fix testcase failures --- .../java/org/apache/iceberg/nessie/BaseTestIceberg.java | 6 ++++++ .../org/apache/iceberg/nessie/TestMultipleClients.java | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java b/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java index ae4947a98cb7..fb42eb76c73b 100644 --- a/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java +++ b/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java @@ -174,6 +174,12 @@ protected Table createTable(TableIdentifier tableIdentifier, Schema schema) { return catalog.createTable(tableIdentifier, schema); } + protected void createTable( + NessieCatalog nessieCatalog, TableIdentifier tableIdentifier, Schema schema) { + createMissingNamespaces(nessieCatalog, tableIdentifier); + nessieCatalog.createTable(tableIdentifier, schema); + } + protected void createMissingNamespaces(TableIdentifier tableIdentifier) { createMissingNamespaces(catalog, tableIdentifier); } diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java index 8da96c224d51..9d4f75f2794f 100644 --- a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java +++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java @@ -98,12 +98,12 @@ public void testLoadNamespaceMetadata() { @Test public void testListTables() { - catalog.createTable(TableIdentifier.parse("foo.tbl1"), schema); + createTable(catalog, TableIdentifier.parse("foo.tbl1"), schema); Assertions.assertThat(catalog.listTables(Namespace.of("foo"))) .containsExactlyInAnyOrder(TableIdentifier.parse("foo.tbl1")); // another client creates a table with the same nessie server - anotherCatalog.createTable(TableIdentifier.parse("foo.tbl2"), schema); + createTable(anotherCatalog, TableIdentifier.parse("foo.tbl2"), schema); Assertions.assertThat(anotherCatalog.listTables(Namespace.of("foo"))) .containsExactlyInAnyOrder( TableIdentifier.parse("foo.tbl1"), TableIdentifier.parse("foo.tbl2")); @@ -116,7 +116,7 @@ public void testListTables() { @Test public void testCommits() { TableIdentifier identifier = TableIdentifier.parse("foo.tbl1"); - catalog.createTable(identifier, schema); + createTable(catalog, identifier, schema); Table tableFromCatalog = catalog.loadTable(identifier); tableFromCatalog.updateSchema().addColumn("x1", Types.LongType.get()).commit(); @@ -133,7 +133,7 @@ public void testCommits() { @Test public void testConcurrentCommitsWithRefresh() { TableIdentifier identifier = TableIdentifier.parse("foo.tbl1"); - catalog.createTable(identifier, schema); + createTable(catalog, identifier, schema); String hashBefore = catalog.currentHash(); From 72f4e4dfd610ffc384934b0af08ae975252c2990 Mon Sep 17 00:00:00 2001 From: ajantha-bhat Date: Tue, 11 Apr 2023 20:27:38 +0530 Subject: [PATCH 2/2] Address comments --- .../java/org/apache/iceberg/nessie/BaseTestIceberg.java | 6 ------ .../org/apache/iceberg/nessie/TestMultipleClients.java | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java b/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java index fb42eb76c73b..ae4947a98cb7 100644 --- a/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java +++ b/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java @@ -174,12 +174,6 @@ protected Table createTable(TableIdentifier tableIdentifier, Schema schema) { return catalog.createTable(tableIdentifier, schema); } - protected void createTable( - NessieCatalog nessieCatalog, TableIdentifier tableIdentifier, Schema schema) { - createMissingNamespaces(nessieCatalog, tableIdentifier); - nessieCatalog.createTable(tableIdentifier, schema); - } - protected void createMissingNamespaces(TableIdentifier tableIdentifier) { createMissingNamespaces(catalog, tableIdentifier); } diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java index 9d4f75f2794f..fb7f4ea3095c 100644 --- a/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java +++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestMultipleClients.java @@ -98,12 +98,12 @@ public void testLoadNamespaceMetadata() { @Test public void testListTables() { - createTable(catalog, TableIdentifier.parse("foo.tbl1"), schema); + createTable(TableIdentifier.parse("foo.tbl1"), schema); Assertions.assertThat(catalog.listTables(Namespace.of("foo"))) .containsExactlyInAnyOrder(TableIdentifier.parse("foo.tbl1")); // another client creates a table with the same nessie server - createTable(anotherCatalog, TableIdentifier.parse("foo.tbl2"), schema); + anotherCatalog.createTable(TableIdentifier.parse("foo.tbl2"), schema); Assertions.assertThat(anotherCatalog.listTables(Namespace.of("foo"))) .containsExactlyInAnyOrder( TableIdentifier.parse("foo.tbl1"), TableIdentifier.parse("foo.tbl2")); @@ -116,7 +116,7 @@ public void testListTables() { @Test public void testCommits() { TableIdentifier identifier = TableIdentifier.parse("foo.tbl1"); - createTable(catalog, identifier, schema); + createTable(identifier, schema); Table tableFromCatalog = catalog.loadTable(identifier); tableFromCatalog.updateSchema().addColumn("x1", Types.LongType.get()).commit(); @@ -133,7 +133,7 @@ public void testCommits() { @Test public void testConcurrentCommitsWithRefresh() { TableIdentifier identifier = TableIdentifier.parse("foo.tbl1"); - createTable(catalog, identifier, schema); + createTable(identifier, schema); String hashBefore = catalog.currentHash();