Revanth14 opened a new pull request, #1324:
URL: https://github.com/apache/iceberg-go/pull/1324
## Summary
This PR implements low-level REST client support for server-side scan
planning.
It adds scan-planning endpoint constants, capability checks, request/header
plumbing, and the four low-level client methods:
- `PlanTableScan`
- `FetchPlanningResult`
- `CancelPlanning`
- `FetchScanTasks`
This is intentionally scoped to the client-method layer only. Higher-level
scan orchestration is left for follow-up work.
## What Changed
### Endpoint Negotiation
Added constants for the scan-planning REST operations:
- `POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan`
- `GET /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan/{plan-id}`
- `DELETE /v1/{prefix}/namespaces/{namespace}/tables/{table}/plan/{plan-id}`
- `POST /v1/{prefix}/namespaces/{namespace}/tables/{table}/tasks`
These are included in `allEndpoints` for template validation, but
deliberately not in `defaultEndpoints`. Catalogs must explicitly advertise
scan-planning support.
### Capability Checks
Implemented:
- `SupportsPlanTableScan`
- `SupportsFullRemoteScanPlanning`
- `SupportsRemoteScanPlanning`
`SupportsFullRemoteScanPlanning` requires all four endpoints because an
initial plan may return async or fanout handles that require polling and task
fetch support.
### Request/Header Handling
Added per-request support for:
- `Idempotency-Key`
- `X-Iceberg-Access-Delegation`
`PlanTableScan` always sends an idempotency key and uses either a
per-request access-delegation value or the session default.
`FetchPlanningResult` uses a per-request access-delegation value when
provided, otherwise the session default.
`FetchScanTasks` sends an idempotency key and suppresses access delegation.
`CancelPlanning` suppresses access delegation and intentionally defers
cancel-specific idempotency/access-delegation API shape until an options type
is added.
### Shared REST Plumbing
Generalized internal REST helpers so requests can:
- set per-request headers
- suppress selected session-default headers
- allow HTTP 204 No Content
`sessionTransport.RoundTrip` now treats any header already present on a
request as overriding the session default. This is needed so scan-planning
calls can override or suppress the default `X-Iceberg-Access-Delegation:
vended-credentials` header.
### Response Validation
Preserved `PlanTableScanResponse.UnmarshalJSON` validation.
Added validation for `FetchPlanningResultResponse`:
- failed responses must include an error payload
- unknown statuses are rejected
- completed, submitted, and cancelled are accepted for polling
A failed `PlanTableScan` response still decodes as `(resp, nil)` when the
failed arm contains an error payload; callers must branch on `resp.Status`.
## Out Of Scope
This PR does not implement:
- `WaitForPlan`
- `Catalog.PlanFiles`
- scanner delegation
- expression JSON public wrappers
- file/delete task decoding
- residual decoding
- plan-scoped FileIO wiring
- retry orchestration
## Tests
Added focused tests for endpoint rendering, capability checks, endpoint
gating, request headers, default/override access delegation behavior,
idempotency key behavior, response validation, `ErrPlanExpired` mapping, and
request-helper body closing.
Validated with:
```bash
go test ./catalog/rest
go test ./...
--
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]