You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "snazy (via GitHub)" <gi...@apache.org> on 2023/05/26 07:02:54 UTC

[GitHub] [iceberg] snazy commented on a diff in pull request #6712: Nessie: Support ApiV2 for Nessie client

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


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -88,11 +89,23 @@ public void initialize(String name, Map<String, String> options) {
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF));
     String requestedHash =
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF_HASH));
-    NessieApiV1 api =
+
+    NessieClientBuilder<?> nessieClientBuilder =
         createNessieClientBuilder(
                 options.get(NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL))
-            .fromConfig(x -> options.get(removePrefix.apply(x)))
-            .build(NessieApiV1.class);
+            .fromConfig(x -> options.get(removePrefix.apply(x)));
+    final String apiVersion = options.get(NessieUtil.CLIENT_API_VERSION);

Review Comment:
   This should be prefixed like all other options IMO



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -88,11 +89,23 @@ public void initialize(String name, Map<String, String> options) {
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF));
     String requestedHash =
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF_HASH));
-    NessieApiV1 api =
+
+    NessieClientBuilder<?> nessieClientBuilder =
         createNessieClientBuilder(
                 options.get(NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL))
-            .fromConfig(x -> options.get(removePrefix.apply(x)))
-            .build(NessieApiV1.class);
+            .fromConfig(x -> options.get(removePrefix.apply(x)));
+    final String apiVersion = options.get(NessieUtil.CLIENT_API_VERSION);

Review Comment:
   Why not `getOrDefault(..., "1")?



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -88,11 +89,23 @@ public void initialize(String name, Map<String, String> options) {
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF));
     String requestedHash =
         options.get(removePrefix.apply(NessieConfigConstants.CONF_NESSIE_REF_HASH));
-    NessieApiV1 api =
+
+    NessieClientBuilder<?> nessieClientBuilder =
         createNessieClientBuilder(
                 options.get(NessieConfigConstants.CONF_NESSIE_CLIENT_BUILDER_IMPL))
-            .fromConfig(x -> options.get(removePrefix.apply(x)))
-            .build(NessieApiV1.class);
+            .fromConfig(x -> options.get(removePrefix.apply(x)));
+    final String apiVersion = options.get(NessieUtil.CLIENT_API_VERSION);
+    NessieApiV1 api;
+    if (apiVersion == null || apiVersion.equalsIgnoreCase("1")) {

Review Comment:
   The `if`-cascade can be replaced with `switch`



-- 
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