Core: add labels to the load table/view read path - #17337
Open
laskoviymishka wants to merge 1 commit into
Open
Conversation
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 23, 2026 14:50
8480d56 to
763bffa
Compare
pvary
reviewed
Jul 24, 2026
pvary
reviewed
Jul 24, 2026
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 24, 2026 12:07
763bffa to
5a6dc57
Compare
laskoviymishka
marked this pull request as ready for review
July 24, 2026 12:14
pvary
reviewed
Jul 24, 2026
pvary
reviewed
Jul 24, 2026
pvary
reviewed
Jul 24, 2026
Contributor
|
How will old REST clients react if there is a new |
Contributor
Author
|
@pvary -- they will simply ignore it. |
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 24, 2026 14:28
5a6dc57 to
210944c
Compare
pvary
reviewed
Jul 24, 2026
Contributor
|
It the spec change is accepted, this is good to go as well. |
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 27, 2026 08:28
210944c to
62a6a3f
Compare
nastra
reviewed
Jul 28, 2026
| @Value.Immutable | ||
| public interface Labels { | ||
| /** Catalog-object-level labels, attached to the object (table, view, ...) as a whole. */ | ||
| Map<String, String> object(); |
Contributor
There was a problem hiding this comment.
have we decided on the naming in the Spec for this? I still feel like object() is really not telling me anything as a reader of the code
Contributor
Author
There was a problem hiding this comment.
We discuss this here - #15750 (comment)
I'm thinking we are close to alignment, i don't have strong preferences honestly, just want to ensure it works :)
nastra
reviewed
Jul 28, 2026
nastra
reviewed
Jul 28, 2026
nastra
reviewed
Jul 28, 2026
nastra
reviewed
Jul 28, 2026
nastra
reviewed
Jul 28, 2026
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 28, 2026 19:31
62a6a3f to
a4c1e5b
Compare
laskoviymishka
force-pushed
the
labels-client-impl
branch
2 times, most recently
from
July 28, 2026 22:25
1162f1a to
7b97096
Compare
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 28, 2026 22:30
7b97096 to
79e2747
Compare
nastra
reviewed
Jul 29, 2026
| } | ||
|
|
||
| @Test | ||
| public void emptyLabels() { |
Contributor
There was a problem hiding this comment.
what about JSON that has empty or no labels defined?
nastra
reviewed
Jul 29, 2026
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 29, 2026 08:30
79e2747 to
c17f158
Compare
This was referenced Jul 29, 2026
Reference client implementation for the IRC labels read-path spec change (apache#15750). Without it, RESTObjectMapper (which sets FAIL_ON_UNKNOWN_PROPERTIES = false) silently drops the labels field on deserialization, so labels returned by a catalog are invisible to the Java client. New rest.labels package (mirroring rest.credentials): Labels (object + fields sub-scopes, with a shared empty instance) and FieldLabels (per-field, keyed by field-id) value types as immutables interfaces, each with a JSON parser. FieldLabels validates field-id >= 1 and a non-empty labels map, matching Credential. Wire an optional labels field into LoadTableResponse / LoadViewResponse and their parsers. labels() never returns null (empty instance when absent), on LoadViewResponse via a @Value.Default default method so no interface API break is introduced. Labels are omitted from the wire when absent (or empty), so the change is additive and backward compatible.
laskoviymishka
force-pushed
the
labels-client-impl
branch
from
July 29, 2026 11:50
c17f158 to
0f538f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference client implementation for the IRC labels read path, the Java-side counterpart to the spec change in #15750.
Why
The spec PR (#15750) adds an optional
labelsfield toLoadTableResultandLoadViewResult. Without a corresponding client change,RESTObjectMapper(which setsFAIL_ON_UNKNOWN_PROPERTIES = false) silently drops the field on deserialization, so labels returned by a catalog are invisible to the Java client. This PR makes the reference client able to read and round-trip them.What changed
New
org.apache.iceberg.rest.labelspackage (laid out likerest.credentials):Labels—object(catalog-object-level, flat string map) andfields(per-field labels).FieldLabels— a single field's labels, identified byfield-id.LabelsParser/FieldLabelsParser— JSON serialization, symmetric with the spec schemas.Wired an optional
labelsfield intoLoadTableResponseandLoadViewResponseand their parsers. Labels are omitted from the wire when absent, so the change is backward compatible — existing responses serialize identically.Tests
TestLabelsParser: round-trips (object-only, fields-only, both), empty labels, andfield-idvalidation.roundTripSerdeWithLabelsandlabelsAreOptionaladded toTestLoadTableResponseParserandTestLoadViewResponseParser.Notes
object/fieldsnaming follows the structure agreed on that PR.UpdateLabels) is a separate follow-up, consistent with the spec PR.