Skip to content

Add optional extraMetadata map to FieldSpec#18984

Draft
navina wants to merge 1 commit into
apache:masterfrom
navina:add-fieldspec-metadata
Draft

Add optional extraMetadata map to FieldSpec#18984
navina wants to merge 1 commit into
apache:masterfrom
navina:add-fieldspec-metadata

Conversation

@navina

@navina navina commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an optional, additive Map<String, String> extraMetadata to FieldSpec for free-form
per-column metadata, mirroring the existing optional fieldId / aliases.

Details

  • @JsonInclude(NON_EMPTY) — omitted from serialization when unset/empty.
  • Excluded from isBackwardCompatibleWith (purely additive, never affects compatibility).
  • Round-tripped through the shared appendFieldIdAliasesAndMetadata helper, so TimeFieldSpec
    preserves it as well.
  • Empty maps are normalized to null in the setter, keeping equality/serialization stable.
  • The keys and their interpretation are defined by whoever populates the map; the core schema
    attaches no semantics to it.

Compatibility

Rolling-upgrade safe: old readers ignore the unknown property (concrete subclasses are
@JsonIgnoreProperties(ignoreUnknown = true)), and new writers omit it when empty, so JSON
produced with this change is unchanged for any schema that does not set it.

Testing

Adds FieldSpecTest coverage: serde round-trip, omitted-when-unset, empty-map-omitted,
TimeFieldSpec-through-Schema, deserialization of older JSON without the field, equals/
hashCode, and exclusion from the backward-compatibility check.

Add an optional, additive Map<String, String> extraMetadata to FieldSpec for
free-form per-column metadata, mirroring the existing optional fieldId/aliases:
@JsonInclude(NON_EMPTY) so it is omitted when unset/empty, excluded from
isBackwardCompatibleWith, and round-tripped via the shared
appendFieldIdAliasesAndMetadata helper (so TimeFieldSpec preserves it too).

The keys and their interpretation are defined by whoever populates it; the core
schema attaches no semantics. Rolling-upgrade safe: old readers ignore the
unknown property (concrete subclasses are @JsonIgnoreProperties(ignoreUnknown)),
new writers omit it when empty.
@codecov-commenter

codecov-commenter commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.06%. Comparing base (a2a27a1) to head (502c142).

Files with missing lines Patch % Lines
...main/java/org/apache/pinot/spi/data/FieldSpec.java 81.81% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #18984   +/-   ##
=========================================
  Coverage     65.05%   65.06%           
  Complexity     1403     1403           
=========================================
  Files          3399     3399           
  Lines        212808   212817    +9     
  Branches      33568    33571    +3     
=========================================
+ Hits         138443   138467   +24     
+ Misses        63223    63213   -10     
+ Partials      11142    11137    -5     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 65.06% <83.33%> (+<0.01%) ⬆️
temurin 65.06% <83.33%> (+<0.01%) ⬆️
unittests 65.06% <83.33%> (+<0.01%) ⬆️
unittests1 56.99% <83.33%> (+<0.01%) ⬆️
unittests2 37.38% <25.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants