GigaMap: ergonomic retrieval of annotation-generated indexers - #695
Merged
Conversation
Annotation-generated indexers had no typed handle like a hand-written `public static final` constant — the only way to query was to fetch them from the BitmapIndices getter API by name, and the caller had to know the exact generated type to pick the right getter. This closes that gap two ways. A) Complete the typed getter set on BitmapIndices for the generator outputs that previously had no working dedicated getter: getIndexerInstant, getIndexerZonedDateTime, getSpatialIndexer, getIndexerComparing (Comparable / java.util.Date), getBinaryIndexer, getByteIndexerNumber and getByteIndexerInstant. Document that the value-typed shortcuts (getIndexerInteger, …) match only the low-cardinality AUTO variant, while @Index(binary = true)/BINARY and BIT_SLICED indices are parallel hierarchies (not IndexerInteger subtypes) that must be fetched via getBinaryIndexer / getByteIndexerNumber. B) IndexerGenerator.generateIndices(...) now returns a GeneratedIndices<E> handle instead of void — a typed, by-name registry of every generated bitmap indexer (regular + unique + spatial), mirroring the BitmapIndices getter surface. The handle can be kept and reused like a hand-written constant. The change is source-compatible: callers ignoring the result still compile. For a reloaded GigaMap, re-running the idempotent generation hands back a fresh handle whose indexers query correctly because conditions resolve against the registered index by name. Adds IndexerRetrievalTest and documents both access paths in the bitmap "defining" guide.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves ergonomics and type-safety for working with annotation-generated bitmap indexers in GigaMap by (1) completing the typed getter surface on BitmapIndices for previously hard-to-retrieve generated indexer variants and (2) introducing a new GeneratedIndices<E> registry handle returned from generation so callers can keep and reuse typed, by-name indexer references (including after reload).
Changes:
- Extend
BitmapIndiceswith additional typed getters for generator outputs (Instant, ZonedDateTime, spatial, comparing, binary, bit-sliced). - Change
IndexerGenerator.generateIndices(...)to return a newGeneratedIndices<E>registry handle (and add that new API type). - Add tests and documentation demonstrating retrieval, querying, and reload behavior using the new APIs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| gigamap/gigamap/src/test/java/org/eclipse/store/gigamap/indexer/annotation/IndexerRetrievalTest.java | Adds tests validating new typed getters and the GeneratedIndices registry, including reload usage. |
| gigamap/gigamap/src/main/java/org/eclipse/store/gigamap/types/IndexerGenerator.java | Updates generation methods to return GeneratedIndices<E> and builds the by-name registry from generated indexers. |
| gigamap/gigamap/src/main/java/org/eclipse/store/gigamap/types/GeneratedIndices.java | Introduces a typed, by-name registry API mirroring BitmapIndices getter surface. |
| gigamap/gigamap/src/main/java/org/eclipse/store/gigamap/types/BitmapIndices.java | Adds missing typed getters for additional generated indexer kinds (instant, zoned date-time, spatial, comparing, binary, bit-sliced). |
| docs/modules/gigamap/pages/indexing/bitmap/defining.adoc | Documents keeping the returned GeneratedIndices handle and clarifies which getter APIs apply to which index variants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…precate the BitmapIndices variant Addresses review feedback on the annotation-generated indexer retrieval API. generateIndices(GigaMap) is now the primary SPI method: it returns a GeneratedIndices handle over the generated indexers and is implemented directly (AnnotationBased routes both public methods through a shared, non-deprecated private worker rather than delegating through the deprecated method). The released void generateIndices(BitmapIndices) keeps its signature (binary compatible for callers) and is marked @deprecated, pointing at the GigaMap variant; it now discards the handle. Removed the bridging interface default and the GeneratedIndices.New(BitmapIndices) snapshot factory that only backed it. GeneratedIndices.all() returned the mutable backing EqHashTable, contradicting its documented immutable-view contract; it now returns an immutable snapshot via immure(). Migrated all annotation tests, the docs example and class Javadoc off the deprecated bitmap variant to generateIndices(GigaMap).
…t getter docs A binary String index (@Index(binary = true) on a String) is a BinaryIndexerString, which extends BinaryCompositeIndexer - neither an IndexerString nor a BinaryIndexer. So getIndexerString and getBinaryIndexer both threw ClassCastException and the indexer was only reachable via the raw get(...). This completes the typed getter surface for generated indexers. Added getBinaryIndexerString(name) to both BitmapIndices and GeneratedIndices. Corrected the getBinaryIndexer Javadoc and the docs NOTE: only binary numeric indexes are BinaryIndexers; binary String uses getBinaryIndexerString and binary UUID uses getIndexerUUID. IndexerRetrievalTest gains a binary String field and asserts the new getter resolves and queries, while getIndexerString/getBinaryIndexer throw ClassCastException for that index.
A @unique field is generated as a binary index even without @Index(binary = true), because the generator uses preferBinary = explicitBinary || (kind == AUTO && unique). So a @unique String (e.g. email / username) is a BinaryIndexerString and must be fetched via getBinaryIndexerString(name); getIndexerString and getBinaryIndexer both throw ClassCastException. Add an IndexerRetrievalTest case using @unique String email that asserts the dedicated getter resolves and queries it (on both BitmapIndices and the GeneratedIndices handle) while the two obvious getters throw. Document the unique-implies-binary promotion in the bitmap index defining guide.
zdenek-jonas
approved these changes
Jun 8, 2026
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.
What
Makes annotation-generated bitmap indexers easy to retrieve and reuse, and completes the typed getter surface for the generated indexer variants.
Before this PR, indexers created by
IndexerGeneratorwere only reachable through theBitmapIndicesgetter API, and several generated variants (binary, bit-sliced, spatial, comparing, Instant, ZonedDateTime) had no matching getter at all — so a caller had to know the exact generated type and, for those variants, had no getter to call.Changes
GeneratedIndices<E>— a typed, by-name handle to generated indexersIndexerGenerator.generateIndices(GigaMap)(and the staticgenerate(...)) now return aGeneratedIndices<E>registry. Callers keep it and reuse the indexers like a hand-writtenpublic static finalconstant:The held indexers resolve against the registered index by name, so they query correctly across reloads — re-run the (idempotent) generation on a loaded map to get a fresh handle.
Completed the BitmapIndices typed getter surface
Added getters for the previously unreachable generated variants: getIndexerInstant, getIndexerZonedDateTime, getIndexerComparing, getSpatialIndexer, getBinaryIndexer, getByteIndexerNumber, getByteIndexerInstant. Documented that the value-typed getters (getIndexerInteger, …) match only the low-cardinality (AUTO) variant, while @Index(binary=true) / kind=BINARY / kind=BIT_SLICED indexes live in the parallel BinaryIndexer / ByteIndexerNumber hierarchies.
SPI shape (review-driven)
Tests
Compatibility
The only released method, void generateIndices(BitmapIndices), is unchanged in signature (deprecated, still functional), so published callers are unaffected.