Skip to content

REST: Restrict visibility of spec-by-id API for scan planning responses#14485

Merged
nastra merged 5 commits into
apache:mainfrom
singhpk234:fix/rest-req-response-model
Nov 4, 2025
Merged

REST: Restrict visibility of spec-by-id API for scan planning responses#14485
nastra merged 5 commits into
apache:mainfrom
singhpk234:fix/rest-req-response-model

Conversation

@singhpk234

@singhpk234 singhpk234 commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

About the change

specs-by-id is not part of the rest spec for the remote scan planning api responses, this was mostly there to aid serialization, for Deserilization we used parser context (orthogonally), following the prinicipal that Response model should only have public APIs for things defined in spec, removing the visibility from public to protected to help avoid confusion that spec-by-id is part of spec.

We can still make sure post deserialization we have specsById as part of Parser context, this change is mainly motivated by rest-spec and existing response models.

Testing

Existing test pass and the compilation succeeds !

Comment thread .palantir/revapi.yml Outdated
new: "method java.util.Map<java.lang.Integer, org.apache.iceberg.PartitionSpec>\
\ org.apache.iceberg.rest.responses.BaseScanTaskResponse::specsById()"
justification: "specById API is not part of Plan API response spec. No actual\
\ breakage because it never worked before."

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.

the because it never worked before seems rather confusing here. Maybe just omit this part?

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 could also just deprecate things and mention that visibility will be reduced in the next release. That way we can avoid breaking the API

@singhpk234 singhpk234 Nov 3, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe just omit this part?

Agree, i just wanted to emphasize that there is no known implementation who would be using it. but it may be possible that some java based catalog have started implementing the server side planning with these models but even for them it would be like a no-op, as the client would not be relying on the field they populated nor it will show up in the rest response (or post-serde)

Thinking more about marking this @deprecated, since we are still using its gonna start generating warnings, which IMHO is fine

Screenshot 2025-11-03 at 6 32 00 AM

please let me know your thoughts considering above

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.

I think having the warning is fine for one release. After one release we'll reduce visibility and remove the deprecation - which will also remove the warning again


protected Map<Integer, PartitionSpec> specsById() {
/**
* @deprecated : visibility will be reduced in 1.12.0.

@nastra nastra Nov 3, 2025

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.

Suggested change
* @deprecated : visibility will be reduced in 1.12.0.
* @deprecated since 1.11.0, visibility will be reduced in 1.12.0.

minor: we typically use that kind of pattern when deprecating

@nastra nastra left a comment

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.

LGTM with a comment around the deprecation msg

@nastra nastra merged commit 329a901 into apache:main Nov 4, 2025
42 checks passed
thomaschow pushed a commit to thomaschow/iceberg that referenced this pull request Jan 19, 2026
talatuyarer pushed a commit to talatuyarer/iceberg that referenced this pull request Apr 1, 2026
dramaticlly added a commit to dramaticlly/iceberg that referenced this pull request Jun 25, 2026
The `specsById` map carried on `BaseScanTaskResponse` and its builder is
parser context, not part of the REST spec for scan-planning response
models. It was deprecated in 1.11.0 (apache#14485) with a note that visibility
would be reduced in 1.12.0.

Demote `specsById()` getter and `withSpecsById()` setter (plus the
builder's `deleteFiles()` getter) from public to protected so the
parsers and subclasses can still use them while keeping the field out of
the public API.

To preserve cross-package construction paths used by `CatalogHandlers`,
`RESTServerCatalogAdapter`, and tests in `org.apache.iceberg.rest`:

- Add `builder(Map<Integer, PartitionSpec> specsById)` factory on each
  of `PlanTableScanResponse`, `FetchPlanningResultResponse`, and
  `FetchScanTasksResponse` for initial server-side construction.
- Add `toBuilder()` on each response for copy-with-modification patterns
  (used when adapters rebuild a response to inject credentials or
  rewrite status).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants