Repository navigation
Spark 4.1: expose catalog labels via metadata table and DESCRIBE - #17411
Closed
laskoviymishka wants to merge 5 commits into
Closed
laskoviymishka wants to merge 5 commits into
laskoviymishka wants to merge 5 commits into
Conversation
laskoviymishka
force-pushed
the
labels-spark
branch
2 times, most recently
from
July 29, 2026 11:50
6d3115f to
9255aa3
Compare
laskoviymishka
force-pushed
the
labels-spark
branch
2 times, most recently
from
August 7, 2026 14:35
d7e4505 to
843fd52
Compare
danielcweeks
reviewed
Aug 7, 2026
| private static final Schema LABELS_SCHEMA = | ||
| new Schema( | ||
| Types.NestedField.required(1, "scope", Types.StringType.get()), | ||
| Types.NestedField.optional(2, "field_id", Types.IntegerType.get()), |
Contributor
There was a problem hiding this comment.
Field name would be nice here as well since field ID to name mapping is difficult to get at.
laskoviymishka
force-pushed
the
labels-spark
branch
from
August 10, 2026 11:37
843fd52 to
1ad4ec8
Compare
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-spark
branch
2 times, most recently
from
August 10, 2026 13:51
a415d61 to
3f0f512
Compare
Adds an `include-labels` flag to the REST server test fixture that attaches labels to load table and load view responses, mirroring how `include-credentials` vends credentials. The injected labels are derived from the catalog name and the server hostname, and the first column of the schema is labeled so that both object-level and field-level labels are covered. This gives other client implementations a reference server that actually returns labels to test against.
laskoviymishka
force-pushed
the
labels-spark
branch
from
August 11, 2026 16:06
3f0f512 to
d26640f
Compare
The raw HTTP client used to read the load responses requires an auth session, so requests failed with "Invalid auth session: null". The local fixture does not authenticate requests, so the empty session is used.
Builds on the labels read-path serde: make the catalog-provided labels from the load response reachable by consumers. - New SupportsLabels mixin interface (mirroring SupportsDistributedScanPlanning) with a single labels() accessor. - BaseTable implements SupportsLabels via a new constructor that carries an optional Labels; existing constructors default to an empty instance. The field is transient and not copied into SerializableTable, so labels are ephemeral catalog enrichment and are not preserved across table serialization. - RESTSessionCatalog populates labels from the load response for both the plain BaseTable and the server-side scan-planning RESTTable paths, across loadTable, registerTable, and createTable.
Builds on the SupportsLabels table exposure to make catalog-provided labels
reachable from Spark.
- New LabelsTable metadata table (core): MetadataTableType.LABELS plus a
BaseMetadataTable that flattens a table's labels into rows
{scope, field_id, key, value}. object-level labels use scope "object" with a
null field_id; field-level labels use scope "field". Registered in
MetadataTableUtils, so it is queryable as `SELECT * FROM tbl.labels` (Spark
routes metadata tables generically, no Spark-side change needed).
- Spark BaseSparkTable.properties() surfaces labels under labels.object.* and
labels.field.<id>.* so they appear in DESCRIBE EXTENDED. Driver-side only;
labels are ephemeral catalog enrichment and are not distributed to executors.
laskoviymishka
force-pushed
the
labels-spark
branch
from
August 11, 2026 16:31
d26640f to
d7386d4
Compare
Contributor
Author
|
Close in favor of cleaned up stack - #18045 |
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.
Makes the catalog-provided labels reachable from Spark.
Stacked on the catalog PR (which is stacked on #17337). Review the top commit — the lower layers belong to the parent PRs.
What changed
LabelsTablemetadata table (core):MetadataTableType.LABELSplus aBaseMetadataTablethat flattens a table's labels into rows{scope, field_id, key, value}. Object-level labels use scopeobjectwith a nullfield_id; field-level labels use scopefield. Registered inMetadataTableUtils, so it is queryable asSELECT * FROM tbl.labels(Spark routes metadata tables generically, no Spark-side change needed for query access).BaseSparkTable.properties()surfaces labels underlabels.object.*andlabels.field.<id>.*so they appear inDESCRIBE EXTENDED. Driver-side only; labels are ephemeral catalog enrichment and are not distributed to executors.