nastra commented on code in PR #13400:
URL: https://github.com/apache/iceberg/pull/13400#discussion_r2538850299


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -2726,6 +2848,103 @@ public void testTableExistsFallbackToGETRequest() {
         
ConfigResponse.builder().withEndpoints(ImmutableList.of(Endpoint.V1_LOAD_TABLE)).build());
   }
 
+  @Test
+  public void testSynchronousPlanningWithAllTasksInSingleResponse() throws 
IOException {
+    // Configure: synchronous planning with all tasks returned in first 
response
+    
configurePlanningBehavior(TestPlanningBehavior.Builder::synchronousWithAllTasks);
+
+    Table table = createTableWithScanPlanning("sync_all_tasks_table");
+    assertBoundFileScanTasks(table, SPEC);
+
+    // Verify actual data file is returned with correct count
+    try (CloseableIterable<FileScanTask> iterable = 
table.newScan().planFiles()) {
+      List<FileScanTask> tasks = Lists.newArrayList(iterable);
+
+      assertThat(tasks).hasSize(1); // 1 data file: FILE_A
+      assertThat(tasks.get(0).file().path()).isEqualTo(FILE_A.path());
+      assertThat(tasks.get(0).deletes()).isEmpty(); // 0 delete files
+    }
+  }
+
+  @Test
+  public void testAsynchronousPlanningWithPolling() throws IOException {
+    // Configure: asynchronous planning (client polls for completion)
+    configurePlanningBehavior(TestPlanningBehavior.Builder::asynchronous);
+
+    Table table = createTableWithScanPlanning("async_planning_table");
+    assertBoundFileScanTasks(table, SPEC);
+
+    // Verify actual data file is returned after async polling with correct 
count
+    try (CloseableIterable<FileScanTask> iterable = 
table.newScan().planFiles()) {
+      List<FileScanTask> tasks = Lists.newArrayList(iterable);
+
+      assertThat(tasks).hasSize(1); // 1 data file: FILE_A
+      assertThat(tasks.get(0).file().path()).isEqualTo(FILE_A.path());
+      assertThat(tasks.get(0).deletes()).isEmpty(); // 0 delete files
+    }
+  }
+
+  @Test
+  public void testSynchronousPlanningWithPagination() throws IOException {
+    // Configure: synchronous planning with 1 task per page (forces pagination)
+    
configurePlanningBehavior(TestPlanningBehavior.Builder::synchronousWithPagination);
+
+    Table table = createTableWithScanPlanning("paginated_table");
+    assertBoundFileScanTasks(table, SPEC);
+
+    // Verify actual data file is returned via plan task fetching with correct 
count
+    try (CloseableIterable<FileScanTask> iterable = 
table.newScan().planFiles()) {
+      List<FileScanTask> tasks = Lists.newArrayList(iterable);
+
+      assertThat(tasks)
+          .isNotEmpty(); // Should have FILE_A (exact count may vary due to 
adapter behavior)

Review Comment:
   I would have assumed that this always just contains FILE_A or is that not 
the case?



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