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


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -3066,6 +3073,101 @@ public void testCommitStateUnknownNotReconciled() {
         .satisfies(ex -> assertThat(((CommitStateUnknownException) 
ex).getSuppressed()).isEmpty());
   }
 
+  @Test
+  public void testCustomTableOperationsInjection() throws IOException {
+    AtomicBoolean customTableOpsCalled = new AtomicBoolean();
+    AtomicBoolean customTransactionTableOpsCalled = new AtomicBoolean();
+
+    // Custom RESTSessionCatalog that overrides table operations creation
+    class CustomRESTSessionCatalog extends RESTSessionCatalog {
+      CustomRESTSessionCatalog(
+          Function<Map<String, String>, RESTClient> clientBuilder,
+          BiFunction<SessionCatalog.SessionContext, Map<String, String>, 
FileIO> ioBuilder) {
+        super(clientBuilder, ioBuilder);
+      }
+
+      @Override
+      protected RESTTableOperations newTableOps(
+          RESTClient restClient,
+          String path,
+          Supplier<Map<String, String>> headers,
+          FileIO fileIO,
+          TableMetadata current,
+          Set<Endpoint> supportedEndpoints) {
+        customTableOpsCalled.set(true);
+        return super.newTableOps(restClient, path, headers, fileIO, current, 
supportedEndpoints);

Review Comment:
   I have answered it in this comment: 
https://github.com/apache/iceberg/pull/14465#issuecomment-3577853929
   
   > The motivation of this PR is to make RESTTableOperations injectable, there 
are many actual use cases and are some platform specific behaviors, I don't 
think we should add tests for it. 
   
   What users do inside their custom operations (add metrics, headers, audit 
logs, validation, custom base metadata, etc.) is up to them, we just need to 
ensure the extension mechanism works. Adding more elaborate verification would 
be testing users' custom logic, not the extensibility itself. This PR is just a 
small PR, I would prefer to keep the test logic simple since it's easier to 
maintain.



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