-
Notifications
You must be signed in to change notification settings - Fork 188
[ISSUE-851] implemented VectorStore and VectorStoreMetadata interfaces with validation and persistence - #855
Conversation
...s with validation and persistence
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Implements the vector store SPI for geaflow-ai, adding a metadata contract plus two concrete store implementations (in-memory and local JSONL persistence), along with basic unit tests.
Changes:
- Added
VectorStoreAPI plus core model types (VectorRecord,VectorQuery,VectorHit) andVectorStoreException. - Implemented
InMemoryVectorStoreandLocalVectorStore(JSONL append + checksum/quarantine). - Added
DistanceMetric/DistanceUtilsand JUnit tests covering basic upsert/search/delete and some validation.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| geaflow-ai/src/test/java/org/apache/geaflow/ai/index/vectorstore/VectorStoreTest.java | Adds unit tests exercising both store implementations and some validation scenarios |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorStoreMetadata.java | Introduces persisted metadata model with constructor validation and equality |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorStoreException.java | Adds domain exception with error codes for consistent failure handling |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorStore.java | Defines the SPI for vector operations (upsert/search/delete/close) |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorRecord.java | Defines the stored vector payload and associated metadata |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorQuery.java | Defines query vector + topK + filter metadata |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/VectorHit.java | Defines search result item (id/score/record) |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/LocalVectorStore.java | Implements a JSONL-backed store with checksum/quarantine and in-memory index |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/InMemoryVectorStore.java | Implements an in-memory store with filtering + topK scoring |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/DistanceUtils.java | Implements scoring for cosine/L2/dot-product |
| geaflow-ai/src/main/java/org/apache/geaflow/ai/index/vectorstore/DistanceMetric.java | Adds supported distance metrics enum |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
What changes were proposed in this pull request?
This PR addresses issue [#851 ] by defining the VectorStore SPI and VectorStoreMetadata contract for the geaflow-ai module.
Major changes include:
• Created the generic VectorStore interface to define standard vector operations (add, delete, search, init).
• Added VectorStoreMetadata with required fields (model_name, dimension, distance, index_version, created_at, format_version) and local fixture
persistence using Gson.
• Implemented strict metadata validation that throws IllegalArgumentException on dimension mismatch, missing metadata, or model
mismatch.
How was this PR tested?
[✓] Tests have Added for the changes
[ ] Production environment verified
Added the VectorStoreMetadataTest which systematically verifies:
• Saving and loading the metadata to/from the JSON local fixture.
• Exception throwing when required fields are missing during validation.
• Exception throwing when testing against dimension or model mismatches.