flyrain commented on code in PR #14465:
URL: https://github.com/apache/iceberg/pull/14465#discussion_r2501685045


##########
core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java:
##########
@@ -63,13 +65,28 @@ public RESTCatalog() {
   }
 
   public RESTCatalog(Function<Map<String, String>, RESTClient> clientBuilder) {
-    this(SessionCatalog.SessionContext.createEmpty(), clientBuilder);
+    this(SessionCatalog.SessionContext.createEmpty(), clientBuilder, null, 
null);

Review Comment:
   ```suggestion
       this(clientBuilder, null, null);
   ```
   
   or 
   ```suggestion
       this(SessionCatalog.SessionContext.createEmpty(), clientBuilder);
   ```
   
   We might go with the second one so that no change is needed here.



##########
core/src/main/java/org/apache/iceberg/rest/RESTTableOperations.java:
##########
@@ -44,10 +44,10 @@
 import org.apache.iceberg.rest.responses.LoadTableResponse;
 import org.apache.iceberg.util.LocationUtil;
 
-class RESTTableOperations implements TableOperations {
+public class RESTTableOperations implements TableOperations {

Review Comment:
   Do we need this scope change?



##########
core/src/main/java/org/apache/iceberg/rest/RESTCatalog.java:
##########
@@ -63,13 +65,28 @@ public RESTCatalog() {
   }
 
   public RESTCatalog(Function<Map<String, String>, RESTClient> clientBuilder) {
-    this(SessionCatalog.SessionContext.createEmpty(), clientBuilder);
+    this(SessionCatalog.SessionContext.createEmpty(), clientBuilder, null, 
null);
   }
 
   public RESTCatalog(
       SessionCatalog.SessionContext context,
       Function<Map<String, String>, RESTClient> clientBuilder) {
-    this.sessionCatalog = new RESTSessionCatalog(clientBuilder, null);
+    this(context, clientBuilder, null, null);
+  }
+
+  public RESTCatalog(
+      Function<Map<String, String>, RESTClient> clientBuilder,
+      BiFunction<SessionCatalog.SessionContext, Map<String, String>, FileIO> 
ioBuilder,
+      RESTOperationsBuilder operationsBuilder) {
+    this(SessionCatalog.SessionContext.createEmpty(), clientBuilder, 
ioBuilder, operationsBuilder);
+  }

Review Comment:
   Is this method necessary if we go with 
`this(SessionCatalog.SessionContext.createEmpty(), clientBuilder);` in line 68?



##########
core/src/main/java/org/apache/iceberg/rest/RESTViewOperations.java:
##########
@@ -29,14 +29,14 @@
 import org.apache.iceberg.view.ViewMetadata;
 import org.apache.iceberg.view.ViewOperations;
 
-class RESTViewOperations implements ViewOperations {
+public class RESTViewOperations implements ViewOperations {

Review Comment:
   Do we need this scope change?



##########
core/src/main/java/org/apache/iceberg/rest/RESTOperationsBuilder.java:
##########
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.rest;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Supplier;
+import org.apache.iceberg.MetadataUpdate;
+import org.apache.iceberg.TableMetadata;
+import org.apache.iceberg.io.FileIO;
+import org.apache.iceberg.view.ViewMetadata;
+
+/**
+ * A builder interface for creating {@link RESTTableOperations} and {@link 
RESTViewOperations}
+ * instances for REST catalogs.
+ *
+ * <p>This interface allows custom implementations of table and view 
operations to be injected into
+ * {@link RESTSessionCatalog} and {@link RESTCatalog}, enabling extensibility 
for specialized use
+ * cases.
+ *
+ * <p>Example usage:
+ *
+ * <pre>
+ * RESTOperationsBuilder customBuilder = new RESTOperationsBuilder() {
+ *   {@literal @}Override
+ *   public RESTTableOperations createTableOperations(
+ *       RESTClient client,
+ *       String path,
+ *       Supplier&lt;Map&lt;String, String&gt;&gt; headers,
+ *       FileIO io,
+ *       TableMetadata current,
+ *       Set&lt;Endpoint&gt; endpoints) {
+ *     return new CustomRESTTableOperations(client, path, headers, io, 
current, endpoints);
+ *   }
+ *
+ *   {@literal @}Override
+ *   public RESTViewOperations createViewOperations(
+ *       RESTClient client,
+ *       String path,
+ *       Supplier&lt;Map&lt;String, String&gt;&gt; headers,
+ *       ViewMetadata current,
+ *       Set&lt;Endpoint&gt; endpoints) {
+ *     return new CustomRESTViewOperations(client, path, headers, current, 
endpoints);
+ *   }
+ * };
+ *
+ * RESTSessionCatalog catalog = new RESTSessionCatalog(clientBuilder, 
ioBuilder, customBuilder);
+ * </pre>
+ */
+public interface RESTOperationsBuilder {

Review Comment:
   It’s more of a factory than a builder. The interface doesn’t progressively 
build or configure objects. It just creates them directly. The intent and usage 
align more closely with a Factory or Provider pattern. Should we rename it to 
xxxFactory? 



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