Feature view versioning was added in feast-dev#6101 and implemented for SQLite only.
Every other online store raises VersionedOnlineReadNotSupported as soon as a
version-qualified reference reaches it, so a Feast deployment on Cassandra
could not use the feature at all.
Cassandra builds every table name in one place, _fq_table_name(), which is
used by the insert, select, create and drop paths alike. It now takes the
versioning flag and defers to compute_versioned_name(), the same helper
SQLite, MySQL and PostgreSQL reach through compute_table_id(), so each
version of a feature view is stored in a table of its own and an unversioned
deployment keeps exactly the names it has today.
Deleting a versioned view drops every version of it rather than only the
current one, following the MySQL and PostgreSQL implementations: the
in-memory feature view carries a single version, so dropping just that one
would leave the other tables orphaned in the keyspace.
CassandraOnlineStore is added to the list of stores that support versioned
reads.
Signed-off-by: Pavel Alekseev <alekceevpavel@mail.ru>
What this PR does / why we need it:
Feature view versioning landed in #6101, but the online-store half of it was
only ever implemented for SQLite. Every other store raises
VersionedOnlineReadNotSupported the moment a version-qualified reference such
as driver_stats@v2:trips_today reaches it, so a deployment on Cassandra or
Astra DB cannot use the feature at all. This adds the missing half for
Cassandra, following the six stores that already have it — FAISS (#6256), Redis
and DynamoDB (#6257), PostgreSQL and MySQL (#6193) and Milvus (#6330).
Cassandra builds every table name in one place, _fq_table_name(), shared by
the insert, select, create and drop paths. It now takes the versioning flag and
defers to compute_versioned_name() — the same helper SQLite, MySQL and
PostgreSQL reach through compute_table_id() — so each version of a feature
view gets a table of its own (test_project_driver_stats_v2). The parameter
defaults to False, and with enable_online_feature_view_versioning off the
computed names are byte-for-byte what they are today.
Two details worth flagging for review:
current one. This follows _drop_all_version_tables in the MySQL and
PostgreSQL stores rather than SQLite: the in-memory FeatureView carries a
single version, so dropping only that one would leave the other tables
orphaned in the keyspace. system_schema cannot match a pattern, so the
keyspace is listed and the names are filtered in Python.
formatted statement text, which contains the fully-qualified table name, so
two versions of a view naturally get two prepared statements.
ScyllaDBOnlineStore has its own copy of _fq_table_name and is deliberately
left alone here — it has a sibling issue of its own.
Which issue(s) this PR fixes:
Fixes #6170
Checks
Testing Strategy
New unit tests in
sdk/python/tests/unit/infra/online_store/test_cassandra_versioning.py, 13 of
them, following the shape of test_redis_versioning.py. Ten of the thirteen
fail without the change. They cover the computed name (off by default, off when
versioning is disabled even with a version set, on with
current_version_number, projection.version_tag taking priority over it,
version 0 taking no suffix, and two versions landing on two different
tables), the fact that a version-qualified read no longer raises, and the drop
path — base plus _v1 plus _v2 all removed, a similarly named
driver_stats_extra left alone, and the unversioned teardown still issuing
exactly one DROP.
The full unit suite passes locally: 2648 passed, 44 skipped, 0 failed, against
2635 passed on master before the change — the difference is the 13 new tests.
Misc
I have not exercised this against a live Cassandra cluster; the store's
existing unit tests patch Cluster so nothing connects, and the
testcontainers-based creator in tests/universal is not wired into
repo_configuration.py. The part that would most benefit from a maintainer's
eye on real hardware is the system_schema.tables query in
_drop_all_version_tables — happy to adjust it, or to drop that behaviour back
to SQLite's "current version only" if you would rather keep the six
implementations identical.
The second commit (docs:) is separable. docs/reference/alpha-feature-view-versioning.md
still said version-qualified reads were SQLite-only, which was already six
stores out of date before this branch; the list it now carries is taken from
OnlineStore._is_versioned_read_supported. Happy to drop that commit if you
would rather keep this PR to the Cassandra store alone.