This is an automated email from the ASF dual-hosted git repository.

blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 8671a93  Nessie: Properly format code in Nessie module (#2733)
8671a93 is described below

commit 8671a938b82a1d0223ea3f784acef429f69d930e
Author: Eduard Tudenhöfner <[email protected]>
AuthorDate: Mon Jul 5 19:59:22 2021 +0200

    Nessie: Properly format code in Nessie module (#2733)
---
 .../org/apache/iceberg/nessie/NessieCatalog.java   | 36 ++++++++++++----------
 .../org/apache/iceberg/nessie/TableReference.java  |  3 +-
 .../org/apache/iceberg/nessie/BaseTestIceberg.java |  6 ++--
 .../org/apache/iceberg/nessie/NessieUtilTest.java  |  1 -
 .../iceberg/nessie/TestBranchVisibility.java       | 13 +++-----
 5 files changed, 27 insertions(+), 32 deletions(-)

diff --git a/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java 
b/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
index d789899..88c4421 100644
--- a/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
+++ b/nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java
@@ -65,9 +65,9 @@ import org.slf4j.LoggerFactory;
  * Nessie implementation of Iceberg Catalog.
  *
  * <p>
- *   A note on namespaces: Nessie namespaces are implicit and do not need to 
be explicitly created or deleted.
- *   The create and delete namespace methods are no-ops for the NessieCatalog. 
One can still list namespaces that have
- *   objects stored in them to assist with namespace-centric catalog 
exploration.
+ * A note on namespaces: Nessie namespaces are implicit and do not need to be 
explicitly created or deleted.
+ * The create and delete namespace methods are no-ops for the NessieCatalog. 
One can still list namespaces that have
+ * objects stored in them to assist with namespace-centric catalog exploration.
  * </p>
  */
 public class NessieCatalog extends BaseMetastoreCatalog implements 
AutoCloseable, SupportsNamespaces, Configurable {
@@ -177,14 +177,14 @@ public class NessieCatalog extends BaseMetastoreCatalog 
implements AutoCloseable
     boolean threw = true;
     try {
       Tasks.foreach(contents)
-           .retry(5)
-           .stopRetryOn(NessieNotFoundException.class)
-           .throwFailureWhenFinished()
-           .onFailure((c, exception) -> refresh())
-           .run(c -> {
-             
client.getTreeApi().commitMultipleOperations(reference.getAsBranch().getName(), 
reference.getHash(), c);
-             refresh(); // note: updated to reference.updateReference() with 
Nessie 0.6
-           }, BaseNessieClientServerException.class);
+          .retry(5)
+          .stopRetryOn(NessieNotFoundException.class)
+          .throwFailureWhenFinished()
+          .onFailure((c, exception) -> refresh())
+          .run(c -> {
+            
client.getTreeApi().commitMultipleOperations(reference.getAsBranch().getName(), 
reference.getHash(), c);
+            refresh(); // note: updated to reference.updateReference() with 
Nessie 0.6
+          }, BaseNessieClientServerException.class);
       threw = false;
     } catch (NessieConflictException e) {
       logger.error("Cannot drop table: failed after retry (update ref and 
retry)", e);
@@ -212,7 +212,8 @@ public class NessieCatalog extends BaseMetastoreCatalog 
implements AutoCloseable
     }
 
     Operations contents = ImmutableOperations.builder()
-        
.addOperations(ImmutablePut.builder().key(NessieUtil.toKey(to)).contents(existingFromTable).build(),
+        .addOperations(
+            
ImmutablePut.builder().key(NessieUtil.toKey(to)).contents(existingFromTable).build(),
             ImmutableDelete.builder().key(NessieUtil.toKey(from)).build())
         .commitMeta(NessieUtil.buildCommitMetadata("iceberg rename table", 
catalogOptions))
         .build();
@@ -227,7 +228,6 @@ public class NessieCatalog extends BaseMetastoreCatalog 
implements AutoCloseable
             
client.getTreeApi().commitMultipleOperations(reference.getAsBranch().getName(), 
reference.getHash(), c);
             refresh();
           }, BaseNessieClientServerException.class);
-
     } catch (NessieNotFoundException e) {
       // important note: the NotFoundException refers to the ref only. If a 
table was not found it would imply that the
       // another commit has deleted the table from underneath us. This would 
arise as a Conflict exception as opposed to
@@ -247,7 +247,7 @@ public class NessieCatalog extends BaseMetastoreCatalog 
implements AutoCloseable
    * creating namespaces in nessie is implicit, therefore this is a no-op. 
Metadata is ignored.
    *
    * @param namespace a multi-part namespace
-   * @param metadata a string Map of properties for the given namespace
+   * @param metadata  a string Map of properties for the given namespace
    */
   @Override
   public void createNamespace(Namespace namespace, Map<String, String> 
metadata) {
@@ -338,11 +338,13 @@ public class NessieCatalog extends BaseMetastoreCatalog 
implements AutoCloseable
       return new UpdateableReference(ref, client.getTreeApi());
     } catch (NessieNotFoundException ex) {
       if (requestedRef != null) {
-        throw new IllegalArgumentException(String.format("Nessie ref '%s' does 
not exist. " +
-            "This ref must exist before creating a NessieCatalog.", 
requestedRef), ex);
+        throw new IllegalArgumentException(String.format(
+            "Nessie ref '%s' does not exist. This ref must exist before 
creating a NessieCatalog.",
+            requestedRef), ex);
       }
 
-      throw new IllegalArgumentException(String.format("Nessie does not have 
an existing default branch." +
+      throw new IllegalArgumentException(String.format(
+          "Nessie does not have an existing default branch." +
               "Either configure an alternative ref via %s or create the 
default branch on the server.",
           NessieConfigConstants.CONF_NESSIE_REF), ex);
     }
diff --git a/nessie/src/main/java/org/apache/iceberg/nessie/TableReference.java 
b/nessie/src/main/java/org/apache/iceberg/nessie/TableReference.java
index 9f613e6..4106496 100644
--- a/nessie/src/main/java/org/apache/iceberg/nessie/TableReference.java
+++ b/nessie/src/main/java/org/apache/iceberg/nessie/TableReference.java
@@ -57,7 +57,8 @@ public class TableReference {
    */
   public static TableReference parse(TableIdentifier path) {
     TableReference pti = parse(path.name());
-    return new TableReference(TableIdentifier.of(path.namespace(), 
pti.tableIdentifier().name()),
+    return new TableReference(
+        TableIdentifier.of(path.namespace(), pti.tableIdentifier().name()),
         pti.timestamp(),
         pti.reference());
   }
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 db45cf0..a73a768 100644
--- a/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java
+++ b/nessie/src/test/java/org/apache/iceberg/nessie/BaseTestIceberg.java
@@ -106,7 +106,7 @@ public abstract class BaseTestIceberg {
         CatalogProperties.URI, uri,
         "auth_type", "NONE",
         CatalogProperties.WAREHOUSE_LOCATION, temp.getRoot().toURI().toString()
-        ));
+    ));
     return newCatalog;
   }
 
@@ -120,8 +120,7 @@ public abstract class BaseTestIceberg {
   }
 
   protected void createTable(TableIdentifier tableIdentifier) {
-    Schema schema = new Schema(StructType.of(required(1, "id", LongType.get()))
-                                         .fields());
+    Schema schema = new Schema(StructType.of(required(1, "id", 
LongType.get())).fields());
     catalog.createTable(tableIdentifier, schema).location();
   }
 
@@ -153,5 +152,4 @@ public abstract class BaseTestIceberg {
     NessieTableOperations icebergOps = (NessieTableOperations) ops;
     return icebergOps.currentMetadataLocation();
   }
-
 }
diff --git a/nessie/src/test/java/org/apache/iceberg/nessie/NessieUtilTest.java 
b/nessie/src/test/java/org/apache/iceberg/nessie/NessieUtilTest.java
index b1dbab9..6c02124 100644
--- a/nessie/src/test/java/org/apache/iceberg/nessie/NessieUtilTest.java
+++ b/nessie/src/test/java/org/apache/iceberg/nessie/NessieUtilTest.java
@@ -25,7 +25,6 @@ import org.assertj.core.api.Assertions;
 import org.junit.Test;
 import org.projectnessie.model.CommitMeta;
 
-
 public class NessieUtilTest {
 
   @Test
diff --git 
a/nessie/src/test/java/org/apache/iceberg/nessie/TestBranchVisibility.java 
b/nessie/src/test/java/org/apache/iceberg/nessie/TestBranchVisibility.java
index 75eabe4..43bbc31 100644
--- a/nessie/src/test/java/org/apache/iceberg/nessie/TestBranchVisibility.java
+++ b/nessie/src/test/java/org/apache/iceberg/nessie/TestBranchVisibility.java
@@ -30,7 +30,6 @@ import org.projectnessie.error.NessieNotFoundException;
 
 public class TestBranchVisibility extends BaseTestIceberg {
 
-
   private final TableIdentifier tableIdentifier1 = 
TableIdentifier.of("test-ns", "table1");
   private final TableIdentifier tableIdentifier2 = 
TableIdentifier.of("test-ns", "table2");
   private NessieCatalog testCatalog;
@@ -40,7 +39,6 @@ public class TestBranchVisibility extends BaseTestIceberg {
     super("main");
   }
 
-
   @Before
   public void before() throws NessieNotFoundException, NessieConflictException 
{
     createTable(tableIdentifier1, 1); // table 1
@@ -55,8 +53,7 @@ public class TestBranchVisibility extends BaseTestIceberg {
     catalog.dropTable(tableIdentifier1);
     catalog.dropTable(tableIdentifier2);
     catalog.refresh();
-    catalog.getTreeApi().deleteBranch("test",
-        catalog.getTreeApi().getReferenceByName("test").getHash());
+    catalog.getTreeApi().deleteBranch("test", 
catalog.getTreeApi().getReferenceByName("test").getHash());
     testCatalog = null;
   }
 
@@ -111,7 +108,7 @@ public class TestBranchVisibility extends BaseTestIceberg {
   }
 
   @Test
-  public void testConcurrentChanges() throws NessieNotFoundException {
+  public void testConcurrentChanges() {
     NessieCatalog emptyTestCatalog = initCatalog("test");
     updateSchema(testCatalog, tableIdentifier1);
     // Updating table with out of date hash. We expect this to succeed because 
of retry despite the conflict.
@@ -122,10 +119,8 @@ public class TestBranchVisibility extends BaseTestIceberg {
     catalog.loadTable(identifier).updateSchema().addColumn("id" + 
schemaCounter++, Types.LongType.get()).commit();
   }
 
-  private void testCatalogEquality(NessieCatalog catalog,
-                                   NessieCatalog compareCatalog,
-                                   boolean table1Equal,
-                                   boolean table2Equal) {
+  private void testCatalogEquality(
+      NessieCatalog catalog, NessieCatalog compareCatalog, boolean 
table1Equal, boolean table2Equal) {
     String testTable1 = metadataLocation(compareCatalog, tableIdentifier1);
     String table1 = metadataLocation(catalog, tableIdentifier1);
     String testTable2 = metadataLocation(compareCatalog, tableIdentifier2);

Reply via email to