Skip to content

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

Open
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:fix/11583-fetch-cancel-planning-endpoints
Open

[#11583] feat(iceberg-rest): Implement fetch and cancel endpoints for async scan planning lifecycle#11635
laserninja wants to merge 1 commit into
apache:mainfrom
laserninja:fix/11583-fetch-cancel-planning-endpoints

Conversation

@laserninja

Copy link
Copy Markdown
Collaborator

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

@laserninja laserninja requested a review from roryqi June 13, 2026 05:13
@laserninja laserninja marked this pull request as ready for review June 13, 2026 05:13
*/
public FetchPlanningResultResponse fetchPlanningResult(
TableIdentifier tableIdentifier, String planId) {
throw new NoSuchPlanIdException(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't override this method.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

…ts for async scan planning lifecycle

Add fetchPlanningResult (GET .../plan/{planId}) and cancelPlanning
(DELETE .../plan/{planId}) endpoints to the Iceberg REST server, wired
through the full dispatcher chain (executor, event, hook dispatchers).

Since Gravitino currently performs synchronous scan planning only,
both methods throw NoSuchPlanIdException (404). This provides correct
HTTP semantics per the Iceberg REST spec while leaving a clear
extension point for future async planning support.

Changes:
- IcebergTableOperationDispatcher: add interface methods
- IcebergTableOperationExecutor: delegate to CatalogWrapperForREST
- IcebergTableEventDispatcher: pre/post/failure event dispatch
- IcebergTableHookDispatcher: pass-through delegation
- CatalogWrapperForREST: throw NoSuchPlanIdException
- IcebergExceptionMapper: map NoSuchPlanIdException to 404
- IcebergTableOperations: REST endpoints with auth and metrics
- OperationType: add FETCH_PLANNING_RESULT, CANCEL_PLANNING
- 6 new event classes for the event listener system
- Tests for both endpoints verifying 404 and event dispatch
@laserninja laserninja force-pushed the fix/11583-fetch-cancel-planning-endpoints branch from c1d78d9 to 98ca42d Compare June 16, 2026 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] Implement fetch and cancel endpoints for async scan planning lifecycle

2 participants