Skip to content

feat: Add versioning support for FAISS online store#6196

Open
rpathade wants to merge 1 commit intofeast-dev:masterfrom
rpathade:feat/faiss_online_store
Open

feat: Add versioning support for FAISS online store#6196
rpathade wants to merge 1 commit intofeast-dev:masterfrom
rpathade:feat/faiss_online_store

Conversation

@rpathade
Copy link
Copy Markdown

@rpathade rpathade commented Mar 30, 2026

What this PR does / why we need it:

Closes #6173

Feature view versioning was introduced in #6101, but version-qualified feature references (e.g. driver_stats@v2:trips_today) only worked with the SQLite online store. All other online stores raised VersionedOnlineReadNotSupported when a versioned ref was used.

This PR adds versioned read/write support to the FAISS online store, following the same pattern as the SQLite reference implementation:

  • Write path: when enable_online_feature_view_versioning is enabled, _table_id appends a _v{N} suffix to the in-memory key namespace (e.g. project_driver_stats_v2), routing materialization to the correct versioned index
  • Read path: version-qualified lookups (@v2) set projection.version_tag on the feature view before online_read is called; _table_id picks this up and routes to the correct index. projection.version_tag takes priority over current_version_number so explicit version requests are always honoured
  • Multi-table support: replaced single class-level _index/_in_memory_store with per-table _indices/_in_memory_stores dicts, so multiple feature views and versions can coexist in memory simultaneously
  • Gate: _check_versioned_read_support in online_store.py now allows FaissOnlineStore through

All existing online_read, online_write_batch, retrieve_online_documents, update, and teardown methods are covered since every method resolves its namespace through _table_id.

Which issue(s) this PR fixes:

Part of #2728

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Added 11 unit tests covering _table_id with versioning disabled, projection.version_tag priority over current_version_number, version 0 edge case, no version info fallback, versioned write/read round trips, namespace isolation between versions, missing index handling, and teardown cleanup.

Misc

  • Removed "type" from mock config in tests to match FaissOnlineStoreConfig's strict pydantic validation (no extra fields permitted)

Open with Devin

Signed-off-by: RutujaPathade <73137503+RutujaPathade@users.noreply.github.com>
@rpathade rpathade force-pushed the feat/faiss_online_store branch from c11eedc to aa79070 Compare March 30, 2026 03:50
@rpathade rpathade changed the title Removed unnecessary lazy imports feat: Add versioning support for FAISS online store Mar 30, 2026
@rpathade rpathade marked this pull request as ready for review March 30, 2026 03:50
@rpathade rpathade requested review from a team as code owners March 30, 2026 03:51
@rpathade rpathade requested review from lokeshrangineni, robhowley and tokoko and removed request for a team March 30, 2026 03:51
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +259 to +262
from feast.infra.online_stores.faiss_online_store import FaissOnlineStore
from feast.infra.online_stores.sqlite import SqliteOnlineStore

if isinstance(self, SqliteOnlineStore):
if isinstance(self, (SqliteOnlineStore, FaissOnlineStore)):
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.

🔴 Importing optional faiss dependency in base OnlineStore breaks all online stores when faiss is not installed

The PR adds from feast.infra.online_stores.faiss_online_store import FaissOnlineStore at online_store.py:259 inside _check_versioned_read_support. This method is called from get_online_features (online_store.py:191) and get_online_features_async (online_store.py:315) for every online store (Redis, DynamoDB, Bigtable, etc.). Since faiss_online_store.py:5 has a top-level import faiss and faiss-cpu is an optional dependency (pyproject.toml:64: faiss = ["faiss-cpu>=1.7.0,<=1.10.0"]), this import will raise ModuleNotFoundError for any user who hasn't installed the faiss extra. The pre-existing SqliteOnlineStore import was safe because sqlite.py only uses stdlib/core imports. The fix should wrap this import in a try/except ImportError and handle the case where FaissOnlineStore is unavailable.

Suggested change
from feast.infra.online_stores.faiss_online_store import FaissOnlineStore
from feast.infra.online_stores.sqlite import SqliteOnlineStore
if isinstance(self, SqliteOnlineStore):
if isinstance(self, (SqliteOnlineStore, FaissOnlineStore)):
try:
from feast.infra.online_stores.faiss_online_store import FaissOnlineStore
except ImportError:
FaissOnlineStore = None
from feast.infra.online_stores.sqlite import SqliteOnlineStore
supported = [SqliteOnlineStore]
if FaissOnlineStore is not None:
supported.append(FaissOnlineStore)
if isinstance(self, tuple(supported)):
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Add feature view versioning support to Faiss online store

1 participant