From 44e8076d3032415538d270407e2f7338968f7279 Mon Sep 17 00:00:00 2001 From: "lukas.valatka" Date: Thu, 22 Jan 2026 17:01:59 +0200 Subject: [PATCH] Disable ODFVs for offline retrieval Signed-off-by: lukas.valatka --- Makefile | 11 +++++++++++ pyproject.toml | 5 +++++ sdk/python/feast/feature_store.py | 12 ++++++++++++ 3 files changed, 28 insertions(+) diff --git a/Makefile b/Makefile index a2ce85a9a82..d24b0f3f0d7 100644 --- a/Makefile +++ b/Makefile @@ -210,6 +210,17 @@ test-python-universal-spark: ## Run Python Spark integration tests not test_snowflake" \ sdk/python/tests +test-python-historical-retrieval: + ## Run Python historical retrieval integration tests + PYTHONPATH='.' \ + FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.spark_repo_configuration \ + PYTEST_PLUGINS=feast.infra.offline_stores.contrib.spark_offline_store.tests \ + python -m pytest -n 8 --integration \ + -k "test_historical_retrieval_with_validation or \ + test_historical_features_persisting or \ + test_historical_retrieval_fails_on_validation" \ + sdk/python/tests + test-python-universal-trino: ## Run Python Trino integration tests PYTHONPATH='.' \ FULL_REPO_CONFIGS_MODULE=sdk.python.feast.infra.offline_stores.contrib.trino_repo_configuration \ diff --git a/pyproject.toml b/pyproject.toml index b729ca4b63e..5370aa54534 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -264,3 +264,8 @@ exclude = [ ".pyi", "protos", "sdk/python/feast/embedded_go/lib"] + +[dependency-groups] +dev = [ + "pytest-xdist>=3.8.0", +] diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py index fc4517281d3..f20c0da092d 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import asyncio +import copy import itertools import os import warnings @@ -1233,6 +1234,17 @@ def get_historical_features( # TODO(achal): _group_feature_refs returns the on demand feature views, but it's not passed into the provider. # This is a weird interface quirk - we should revisit the `get_historical_features` to # pass in the on demand feature views as well. + + # Deliberately disable writing to online store for ODFVs during historical retrieval + # since it's not applicable in this context. + # This does not change the output, since it forces to recompute ODFVs on historical retrieval + # but that is fine, since ODFVs precompute does not to work for historical retrieval (as per docs), only for online retrieval + # Copy to avoid side effects outside of this method + all_on_demand_feature_views = copy.deepcopy(all_on_demand_feature_views) + + for odfv in all_on_demand_feature_views: + odfv.write_to_online_store = False + fvs, odfvs = utils._group_feature_refs( _feature_refs, all_feature_views,