You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "laserninja (via GitHub)" <gi...@apache.org> on 2026/06/13 05:11:54 UTC

[PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

laserninja opened a new pull request, #11635:
URL: https://github.com/apache/gravitino/pull/11635

   ### What changes were proposed in this pull request?
   
   Implement `fetchPlanningResult` (`GET /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan/{planId}`) and `cancelPlanning` (`DELETE .../plan/{planId}`) endpoints for the Iceberg REST server, wired through the full dispatcher chain.
   
   **Files changed:**
   - **`IcebergTableOperations`**: Two new JAX-RS endpoints with metrics, authorization, and logging
   - **`IcebergTableOperationDispatcher`**: Interface methods for `fetchPlanningResult` and `cancelPlanning`
   - **`IcebergTableOperationExecutor`**: Delegates to `CatalogWrapperForREST`
   - **`IcebergTableEventDispatcher`**: Pre/post/failure event dispatch
   - **`IcebergTableHookDispatcher`**: Pass-through delegation (no hooks needed)
   - **`CatalogWrapperForREST`**: Throws `NoSuchPlanIdException` (sync-only planning)
   - **`IcebergExceptionMapper`**: Maps `NoSuchPlanIdException` → 404
   - **`OperationType`**: Adds `FETCH_PLANNING_RESULT` and `CANCEL_PLANNING`
   - **6 new event classes**: Pre/post/failure events for both operations
   
   ### Why are the changes needed?
   
   The Iceberg REST spec defines endpoints for fetching and cancelling async scan plans. Even though Gravitino currently only supports synchronous scan planning (always returns `COMPLETED`), these endpoints must exist to be spec-compliant. They correctly return 404 since no async plan IDs are retained, and provide a clear extension point for future async support.
   
   Fix: #11583
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes — two new REST API endpoints:
   - `GET /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan/{planId}` — returns 404 (no async plans exist)
   - `DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan/{planId}` — returns 404 (no async plans exist)
   
   ### How was this patch tested?
   
   - Added `testFetchPlanningResultNotFound` and `testCancelPlanningNotFound` in `TestIcebergTableOperations`
   - Tests verify 404 response status and correct event dispatch (`PreEvent` + `FailureEvent`)
   - All existing tests continue to pass: `./gradlew :iceberg:iceberg-rest-server:test -PskipITs`


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3409752233


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -462,6 +464,42 @@ public PlanTableScanResponse planTableScan(
     }
   }
 
+  /**
+   * Fetch the result of a previously submitted async scan plan.
+   *
+   * <p>The current implementation performs synchronous scan planning only (always returns {@code
+   * COMPLETED} from {@link #planTableScan}), so no plan IDs are retained. This method always throws
+   * {@link NoSuchPlanIdException}.
+   *
+   * @param tableIdentifier The table identifier.
+   * @param planId The plan identifier to look up.
+   * @return never returns normally.
+   * @throws NoSuchPlanIdException always, because synchronous planning does not retain plan IDs.
+   */
+  public FetchPlanningResultResponse fetchPlanningResult(
+      TableIdentifier tableIdentifier, String planId) {
+    throw new NoSuchPlanIdException(

Review Comment:
   We don't override this method.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4830295098

   @lasdf1234 Could u help me review this pull request?


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4847473000

   done


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3593543669


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Without implementing these two methods, we cannot legitimately claim to have fully implemented the interfaces, as required by the interface contract.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4841210976

   Could you modify AuditLog? add enum type :FETCH_PLANNING_RESULT、CANCEL_PLANNING?


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3612760422


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   @laserninja If this issue is resolved, you can ask Rory to continue the review.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3618830459


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Could u implement this method?



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-5500756981

   @lasdf1234 can you check this please 


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4830338918

   > @lasdf1234 Could u help me review this pull request?
   
   Got


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3592964776


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(
+        "Plan %s not found for table %s. Synchronous planning does not retain plan IDs.",
+        planId, tableIdentifier);
+  }
+
+  @Override
+  public void cancelPlanning(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager

Review Comment:
   Same as below: this is the leaf implementation of the dispatcher interface and the only layer that can validate the table exists, so it needs to be implemented here. See the reply on `fetchPlanningResult` for the full reasoning.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3592964776


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(
+        "Plan %s not found for table %s. Synchronous planning does not retain plan IDs.",
+        planId, tableIdentifier);
+  }
+
+  @Override
+  public void cancelPlanning(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager

Review Comment:
   This is the leaf implementation of the dispatcher interface and the only layer that can validate the table exists, so it needs to be implemented here. See the reply on `fetchPlanningResult` for the full reasoning.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4832722083

   Could you same with planTableScan?
   1、The error logs of the REST layer are not same with planTableScan. Could you use LOG.error?
   2、The behavior when the table does not exist should also be consistent with that of planTableScan.


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4849669431

   @roryqi  I have nothing to comment.


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-5903212310

   @roryqi done


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3616472617


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   @roryqi can you check please



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4922520857

   @roryqi If you have the time, could you take a look at this PR?
   I don't have any other comments.
   LGTM to me.


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3592963761


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Yes, these need to be implemented here. `IcebergTableOperationExecutor` is the leaf implementation of the `IcebergTableOperationDispatcher` interface. The `IcebergTableEventDispatcher` and `IcebergTableHookDispatcher` decorators delegate down to it, and this is the only layer with access to `icebergCatalogWrapperManager` to validate the table exists before responding.
   
   Since Gravitino only supports synchronous scan planning today (`planTableScan` always returns `COMPLETED` and no plan IDs are retained), there's no async plan to fetch or cancel, so the correct spec-compliant behavior is to return 404. We still load the table first so a missing table returns `NoSuchTableException` (404), consistent with `planTableScan`, per the earlier review feedback.
   
   The interface methods are abstract (not `default`), so every implementer must provide them. If async planning is added later, this is the natural place to wire in the real lookup.
   
   Happy to add a `default` throwing implementation on the interface instead if you'd prefer to slim down the executor, but that would lose the table-existence validation.



##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(
+        "Plan %s not found for table %s. Synchronous planning does not retain plan IDs.",
+        planId, tableIdentifier);
+  }
+
+  @Override
+  public void cancelPlanning(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager

Review Comment:
   Same as above: this is the leaf implementation of the dispatcher interface and the only layer that can validate the table exists, so it needs to be implemented here. See the reply on `fetchPlanningResult` for the full reasoning.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3423024589


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/CatalogWrapperForREST.java:
##########
@@ -462,6 +464,42 @@ public PlanTableScanResponse planTableScan(
     }
   }
 
+  /**
+   * Fetch the result of a previously submitted async scan plan.
+   *
+   * <p>The current implementation performs synchronous scan planning only (always returns {@code
+   * COMPLETED} from {@link #planTableScan}), so no plan IDs are retained. This method always throws
+   * {@link NoSuchPlanIdException}.
+   *
+   * @param tableIdentifier The table identifier.
+   * @param planId The plan identifier to look up.
+   * @return never returns normally.
+   * @throws NoSuchPlanIdException always, because synchronous planning does not retain plan IDs.
+   */
+  public FetchPlanningResultResponse fetchPlanningResult(
+      TableIdentifier tableIdentifier, String planId) {
+    throw new NoSuchPlanIdException(

Review Comment:
   done



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "lasdf1234 (via GitHub)" <gi...@apache.org>.
lasdf1234 commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4966335557

   @laserninja Coluld you follow up this PR?


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-4848010245

   <!-- coverage-report -->
   ### Code Coverage Report
   |Overall Project|67.33% **`+0.34%`**|:green_circle:|
   |:-|:-|:-:|
   |Files changed|91.6%|:green_circle:|
   <br>
   
   |Module|Coverage||
   |:-|:-|:-:|
   |aliyun|1.72%|:red_circle:|
   |api|46.82%|:green_circle:|
   |authorization-common|85.96%|:green_circle:|
   |aws|26.5%|:red_circle:|
   |azure|2.47%|:red_circle:|
   |catalog-common|10.4%|:red_circle:|
   |catalog-fileset|80.23%|:green_circle:|
   |catalog-glue|66.91%|:green_circle:|
   |catalog-hive|79.42%|:green_circle:|
   |catalog-jdbc-clickhouse|80.2%|:green_circle:|
   |catalog-jdbc-common|44.22%|:green_circle:|
   |catalog-jdbc-doris|80.28%|:green_circle:|
   |catalog-jdbc-hologres|54.03%|:green_circle:|
   |catalog-jdbc-mysql|79.23%|:green_circle:|
   |catalog-jdbc-oceanbase|80.91%|:green_circle:|
   |catalog-jdbc-postgresql|82.29%|:green_circle:|
   |catalog-jdbc-starrocks|78.51%|:green_circle:|
   |catalog-kafka|77.01%|:green_circle:|
   |catalog-lakehouse-generic|58.53%|:green_circle:|
   |catalog-lakehouse-hudi|79.1%|:green_circle:|
   |catalog-lakehouse-iceberg|85.86%|:green_circle:|
   |catalog-lakehouse-paimon|82.14%|:green_circle:|
   |catalog-model|77.72%|:green_circle:|
   |cli|44.51%|:green_circle:|
   |client-java|78.01%|:green_circle:|
   |common|50.17%|:green_circle:|
   |core|82.59% **`+0.35%`**|:green_circle:|
   |filesystem-hadoop3|77.3%|:green_circle:|
   |flink|0.0%|:red_circle:|
   |flink-common|47.12%|:green_circle:|
   |flink-runtime|0.0%|:red_circle:|
   |gcp|14.12%|:red_circle:|
   |hadoop-common|10.88%|:red_circle:|
   |hive-metastore-common|53.77%|:green_circle:|
   |iceberg-common|58.15%|:green_circle:|
   |iceberg-rest-server|73.78% **`+2.36%`**|:green_circle:|
   |idp-basic|85.71%|:green_circle:|
   |integration-test-common|0.0%|:red_circle:|
   |jobs|66.17%|:green_circle:|
   |lance-common|20.81%|:red_circle:|
   |lance-rest-server|64.84%|:green_circle:|
   |lineage|53.02%|:green_circle:|
   |optimizer|83.24%|:green_circle:|
   |optimizer-api|21.95%|:red_circle:|
   |server|85.96%|:green_circle:|
   |server-common|74.18%|:green_circle:|
   |spark|28.57%|:red_circle:|
   |spark-common|45.58%|:green_circle:|
   |trino-connector|40.29%|:green_circle:|
   
   <details>
   <summary>Files</summary>
   
   |Module|File|Coverage||
   |:-|:-|:-|:-:|
   |core|[OperationType.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/core/src/main/java/org/apache/gravitino/listener/api/event/OperationType.java)|100.0%|:green_circle:|
   ||[CompatibilityUtils.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/core/src/main/java/org/apache/gravitino/audit/v2/CompatibilityUtils.java)|99.35%|:green_circle:|
   ||[AuditLog.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/core/src/main/java/org/apache/gravitino/audit/AuditLog.java)|97.54%|:green_circle:|
   |iceberg-rest-server|[IcebergTableOperationExecutor.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java)|100.0%|:green_circle:|
   ||[IcebergExceptionMapper.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/IcebergExceptionMapper.java)|96.3%|:green_circle:|
   ||[IcebergTableEventDispatcher.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableEventDispatcher.java)|90.54%|:green_circle:|
   ||[IcebergTableOperations.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java)|80.89%|:green_circle:|
   ||[IcebergTableHookDispatcher.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableHookDispatcher.java)|78.79%|:green_circle:|
   ||[IcebergCancelPlanningFailureEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCancelPlanningFailureEvent.java)|66.67%|:green_circle:|
   ||[IcebergCancelPlanningPreEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCancelPlanningPreEvent.java)|66.67%|:green_circle:|
   ||[IcebergFetchPlanningResultFailureEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergFetchPlanningResultFailureEvent.java)|66.67%|:green_circle:|
   ||[IcebergFetchPlanningResultPreEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergFetchPlanningResultPreEvent.java)|66.67%|:green_circle:|
   ||[IcebergTableOperationDispatcher.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationDispatcher.java)|0.0%|:red_circle:|
   ||[IcebergCancelPlanningEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergCancelPlanningEvent.java)|0.0%|:red_circle:|
   ||[IcebergFetchPlanningResultEvent.java](https://github.com/laserninja/gravitino/blob/91bb71551d1ba384f36586c52bed906dd6c88bf1/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/listener/api/event/IcebergFetchPlanningResultEvent.java)|0.0%|:red_circle:|
   
   </details>


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#issuecomment-5902512084

   @laserninja Could u resolve the conflicts?


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3549640896


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Do u need to implement this method?



##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(
+        "Plan %s not found for table %s. Synchronous planning does not retain plan IDs.",
+        planId, tableIdentifier);
+  }
+
+  @Override
+  public void cancelPlanning(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager

Review Comment:
   Do u need to implement this method?



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "roryqi (via GitHub)" <gi...@apache.org>.
roryqi commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3618830459


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   I don't see the concrete implement. Could u implement this method in this pull request?



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3647777231


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Done. `fetchPlanningResult` and `cancelPlanning` now have a concrete implementation backed by a plan-id registry in `CatalogWrapperForREST`.
   
   How it works:
   - `planTableScan` registers each completed result under a generated plan id (Caffeine cache, sized by the existing `scan-plan-cache` capacity/expiry config) and returns it as `plan-id` in the `COMPLETED` response. Iceberg's `PlanTableScanResponse.validate()` allows a `plan-id` on a `COMPLETED` result, so this stays spec-compliant.
   - `fetchPlanningResult(tableId, planId)` validates the table exists, then returns the registered `FetchPlanningResultResponse` (status `COMPLETED` + tasks). Unknown or expired plan ids throw `NoSuchPlanIdException` (404).
   - `cancelPlanning(tableId, planId)` validates the table, then removes the plan from the registry (404 if unknown). A subsequent fetch then returns 404.
   
   The executor now delegates to `CatalogWrapperForREST` (same pattern as `planTableScan`) instead of throwing directly.
   
   Added tests: `testFetchPlanningResultSuccess` (plan -> fetch the returned plan-id -> 200 with tasks) and `testCancelPlanningSuccess` (plan -> cancel -> 204 -> subsequent fetch -> 404), alongside the existing unknown-plan-id and table-not-found 404 cases.



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle [gravitino]

Posted by "laserninja (via GitHub)" <gi...@apache.org>.
laserninja commented on code in PR #11635:
URL: https://github.com/apache/gravitino/pull/11635#discussion_r3597042324


##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/dispatcher/IcebergTableOperationExecutor.java:
##########
@@ -227,6 +229,32 @@ public PlanTableScanResponse planTableScan(
         .planTableScan(tableIdentifier, scanRequest);
   }
 
+  @Override
+  public FetchPlanningResultResponse fetchPlanningResult(
+      IcebergRequestContext context, TableIdentifier tableIdentifier, String planId) {
+    // Validate the table exists first (consistent with planTableScan behavior)
+    icebergCatalogWrapperManager
+        .getCatalogWrapper(context.catalogName())
+        .getCatalog()
+        .loadTable(tableIdentifier);
+    throw new NoSuchPlanIdException(

Review Comment:
   Agreed, thanks!



-- 
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: commits-unsubscribe@gravitino.apache.org

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