You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/04/05 10:37:27 UTC

[GitHub] [iceberg] snazy commented on a diff in pull request #4491: Nessie: simplify code in Nessie catalog

snazy commented on code in PR #4491:
URL: https://github.com/apache/iceberg/pull/4491#discussion_r842629684


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -165,14 +140,13 @@ protected TableOperations newTableOps(TableIdentifier tableIdentifier) {
     TableReference tr = TableReference.parse(tableIdentifier.name());
     Preconditions.checkArgument(!tr.hasTimestamp(), "Invalid table name: # is only allowed for hashes (reference by " +
         "timestamp is not supported)");
-    UpdateableReference newReference = this.reference;
+    NessieIcebergClient newClient = client;
     if (tr.getReference() != null) {
-      newReference = loadReference(tr.getReference(), tr.getHash());
+      newClient = new NessieIcebergClient(client.getApi(), tr.getReference(), tr.getHash(), catalogOptions);

Review Comment:
   Looks like this can become a `forTableReference(tr)` (that also accepts `null`) - then it seems you can get rid of the `catalogOptions` field in this clas.
   
   I.e. the below would become:
   ```java
       return new NessieTableOperations(
           ContentKey.of(org.projectnessie.model.Namespace.of(tableIdentifier.namespace().levels()), tr.getName()),
           client.forTableReference(tr),,
           fileIO,
           catalogOptions);
   ```



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -133,7 +105,10 @@ public void initialize(String inputName, Map<String, String> options) {
       throw new IllegalStateException("Parameter 'warehouse' not set, Nessie can't store data.");
     }
     final String requestedRef = options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF));
-    this.reference = loadReference(requestedRef, null);
+    NessieApiV1 api = createNessieClientBuilder(options.get(NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL))

Review Comment:
   Maybe move this (lines 107..111) into a static builder-ish method in NessieIcebergClient? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org