dimas-b commented on code in PR #6712:
URL: https://github.com/apache/iceberg/pull/6712#discussion_r1198970876


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -88,11 +89,24 @@ 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("v2")) {
+      // default version is set to v2.
+      api = nessieClientBuilder.build(NessieApiV2.class);

Review Comment:
   I'd still default to v1. Otherwise, users with existing jobs will get 
failures because of URI / API version mismatch and will have to debug failures 
and adjust their configs with urgency.



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieUtil.java:
##########
@@ -37,6 +37,8 @@ public final class NessieUtil {
   public static final String NESSIE_CONFIG_PREFIX = "nessie.";
   static final String APPLICATION_TYPE = "application-type";
 
+  public static final String CLIENT_API_VERSION = "client-api-version";

Review Comment:
   Actually, it might be possible to have a constant for the API version on the 
Nessie Client side, but then the client should be choosing the class object for 
the `build(...)` call. This might be an option for a smooth migration path from 
API v1 to v2... but certainly it requires some Nessie-side changes.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to