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


##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -128,6 +133,26 @@ public void initialize(String name, Map<String, String> 
options) {
         catalogOptions);
   }
 
+  private static String inferVersionFromURI(String uri) {
+    if (uri == null) {
+      throw new IllegalArgumentException("URI is not specified in the catalog 
properties");
+    }
+
+    // match for uri ending with /v1, /v2 etc
+    Pattern pattern = Pattern.compile("/v(\\d+)$");
+    Matcher matcher = pattern.matcher(uri);
+    // Extract and print the version number
+    if (matcher.find()) {
+      return matcher.group(1);
+    } else {
+      throw new IllegalArgumentException(
+          String.format(
+              "URI doesn't end with the version: %s. "
+                  + "Please configure `client-api-version` in the catalog 
properties explicitly.",

Review Comment:
   I wonder whether we can just assume `v2` in this case... but I'm fine with 
throwing an exception too.



##########
nessie/src/main/java/org/apache/iceberg/nessie/NessieCatalog.java:
##########
@@ -128,6 +133,26 @@ public void initialize(String name, Map<String, String> 
options) {
         catalogOptions);
   }
 
+  private static String inferVersionFromURI(String uri) {
+    if (uri == null) {
+      throw new IllegalArgumentException("URI is not specified in the catalog 
properties");
+    }
+
+    // match for uri ending with /v1, /v2 etc
+    Pattern pattern = Pattern.compile("/v(\\d+)$");
+    Matcher matcher = pattern.matcher(uri);
+    // Extract and print the version number

Review Comment:
   nit: the version is not actually printed, is it?



-- 
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-unsubscr...@iceberg.apache.org

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


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

Reply via email to