Skip to content

GigaMap: ergonomic retrieval of annotation-generated indexers - #695

Merged
fh-ms merged 5 commits into
mainfrom
gigamap-index-access
Jun 8, 2026
Merged

GigaMap: ergonomic retrieval of annotation-generated indexers#695
fh-ms merged 5 commits into
mainfrom
gigamap-index-access

Conversation

@fh-ms

@fh-ms fh-ms commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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 IndexerGenerator were only reachable through the BitmapIndices getter 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 indexers IndexerGenerator.generateIndices(GigaMap) (and the static generate(...)) now return a GeneratedIndices<E> registry. Callers keep it and reuse the indexers like a hand-written public static final constant:

GeneratedIndices<Person> idx = IndexerGenerator.AnnotationBased(Person.class).generateIndices(gigaMap);
gigaMap.query(idx.getIndexerString("firstName").startsWith("J"));
gigaMap.query(idx.getIndexerLocalDate("dateOfBirth").after(LocalDate.of(2000, 1, 1)));

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)

  • generateIndices(GigaMap) is now the primary generation SPI method and returns the handle; it is implemented directly (no delegation through the deprecated method).
  • The released void generateIndices(BitmapIndices) keeps its signature (binary-compatible for callers) and is @deprecated in favour of the GigaMap variant.
  • GeneratedIndices.all() returns an immutable snapshot (immure()) rather than the mutable backing table, honouring its documented contract.

Tests

  • New IndexerRetrievalTest covers every new getter, the GeneratedIndices registry (typed convenience + raw get), and reuse after reload.
  • All existing annotation tests migrated to generateIndices(GigaMap).
  • gigamap annotation + retrieval suites and the lucene/jvector handler-based generation suites pass (gigamap 45; lucene+jvector 237, 9 skipped).

Compatibility

The only released method, void generateIndices(BitmapIndices), is unchanged in signature (deprecated, still functional), so published callers are unaffected.

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.
@fh-ms fh-ms added enhancement New feature or request GigaMap labels Jun 5, 2026
@fh-ms
fh-ms requested a review from Copilot June 5, 2026 09:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BitmapIndices with additional typed getters for generator outputs (Instant, ZonedDateTime, spatial, comparing, binary, bit-sliced).
  • Change IndexerGenerator.generateIndices(...) to return a new GeneratedIndices<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).
@fh-ms
fh-ms requested a review from zdenek-jonas June 5, 2026 11:27
fh-ms added 3 commits June 8, 2026 12:48
…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.
@fh-ms
fh-ms merged commit cdda7e1 into main Jun 8, 2026
14 checks passed
@fh-ms
fh-ms deleted the gigamap-index-access branch June 8, 2026 13:19
@fh-ms fh-ms added this to the 4.2.0 milestone Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request GigaMap

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants