kbendick commented on code in PR #4495:
URL: https://github.com/apache/iceberg/pull/4495#discussion_r847715498


##########
core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java:
##########
@@ -69,12 +75,31 @@ public class RESTCatalog implements Catalog, 
SupportsNamespaces, Configurable<Co
   private Object conf = null;
   private FileIO io = null;
 
+  public RESTCatalog() {
+    this(new HTTPClientFactory());
+  }
+
   RESTCatalog(Function<Map<String, String>, RESTClient> clientBuilder) {
     this.clientBuilder = clientBuilder;
   }
 
   @Override
   public void initialize(String name, Map<String, String> props) {
+    RESTCatalogConfigResponse config = fetchConfig(props);
+    Map<String, String> mergedProps = config.merge(props);
+    initializePostConfig(name, mergedProps);
+  }
+
+  /**
+   * Performs the normal initialization steps after calling the config route 
and merging the initial
+   * configuration with any configuration provided by the server.
+   * <p>
+   * See {@link RESTCatalogConfigResponse} for details on merging the initial 
client and server configuration.
+   *
+   * @param name  Name of this RESTCatalog
+   * @param props Properties to use, merged with any server-provided 
configuration.
+   */
+  private void initializePostConfig(String name, Map<String, String> props) {

Review Comment:
   My main reasoning for making it a separate function was so that the 
non-merged properties didn't get reused accidentally. I can merge it into one 
function if we prefer.



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