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.

Details

  • @JsonInclude(NON_EMPTY) — omitted from serialization when unset/empty.
  • Excluded from isBackwardCompatibleWith (purely additive, never affects compatibility).
  • Round-tripped through the shared appendFieldIdAndAliases 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.

@codecov-commenter

codecov-commenter commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.23%. Comparing base (a2a27a1) to head (6c2b0c7).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...main/java/org/apache/pinot/spi/data/FieldSpec.java 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18984      +/-   ##
============================================
+ Coverage     65.05%   65.23%   +0.17%     
- Complexity     1403     1405       +2     
============================================
  Files          3399     3418      +19     
  Lines        212808   214651    +1843     
  Branches      33568    33922     +354     
============================================
+ Hits         138443   140018    +1575     
- Misses        63223    63335     +112     
- Partials      11142    11298     +156     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 65.23% <80.00%> (+0.17%) ⬆️
temurin 65.23% <80.00%> (+0.17%) ⬆️
unittests 65.22% <80.00%> (+0.17%) ⬆️
unittests1 56.88% <80.00%> (-0.11%) ⬇️
unittests2 37.73% <10.00%> (+0.35%) ⬆️

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.

@navina navina force-pushed the add-fieldspec-metadata branch from 502c142 to 4d10b2f Compare July 14, 2026 05:56
Add an optional, additive Map<String, String> extraMetadata to FieldSpec for
free-form per-column metadata: @JsonInclude(NON_EMPTY) so it is omitted when
unset/empty, excluded from isBackwardCompatibleWith, and round-tripped via the
shared appendFieldIdAndAliases 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.
@navina navina force-pushed the add-fieldspec-metadata branch from 4d10b2f to 6c2b0c7 Compare July 14, 2026 05:59
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