@@ -181,3 +181,49 @@ def test_write_to_offline_store_resolves_feature_view_with_single_lookup():
181181 registry .get_label_view .assert_not_called ()
182182
183183 provider .ingest_df_to_offline_store .assert_called_once ()
184+
185+
186+ def test_get_historical_features_non_entity_default_end_date_is_utc (tmp_path ):
187+ """With entity_df=None and no end_date, the end bound handed to the provider
188+ must be the current time in UTC. Offline stores read a naive datetime as UTC
189+ (utils.make_tzaware), so a naive local value shifts the window by the host offset."""
190+ from datetime import datetime , timedelta , timezone
191+
192+ from feast import Entity , FeatureView , Field , FileSource
193+ from feast .infra .offline_stores .dask import DaskOfflineStoreConfig
194+ from feast .infra .online_stores .sqlite import SqliteOnlineStoreConfig
195+ from feast .repo_config import RepoConfig
196+ from feast .types import Int64
197+
198+ store = FeatureStore (
199+ config = RepoConfig (
200+ project = "non_entity_default_end_date" ,
201+ registry = str (tmp_path / "registry.db" ),
202+ provider = "local" ,
203+ entity_key_serialization_version = 3 ,
204+ offline_store = DaskOfflineStoreConfig (),
205+ online_store = SqliteOnlineStoreConfig (path = str (tmp_path / "online.db" )),
206+ )
207+ )
208+ driver = Entity (name = "driver" , join_keys = ["driver_id" ])
209+ driver_stats = FeatureView (
210+ name = "driver_stats" ,
211+ entities = [driver ],
212+ ttl = timedelta (days = 1 ),
213+ schema = [Field (name = "driver_id" , dtype = Int64 ), Field (name = "value" , dtype = Int64 )],
214+ source = FileSource (
215+ path = str (tmp_path / "driver_stats.parquet" ),
216+ timestamp_field = "event_timestamp" ,
217+ ),
218+ )
219+ store .apply ([driver , driver_stats ])
220+
221+ provider = MagicMock ()
222+ before = datetime .now (timezone .utc )
223+ with patch .object (FeatureStore , "_get_provider" , return_value = provider ):
224+ store .get_historical_features (entity_df = None , features = ["driver_stats:value" ])
225+ after = datetime .now (timezone .utc )
226+
227+ end_date = provider .get_historical_features .call_args .kwargs ["end_date" ]
228+ assert end_date .utcoffset () == timedelta (0 )
229+ assert before <= utils .make_tzaware (end_date ) <= after
0 commit comments