@@ -209,3 +209,47 @@ def test_materialize_odfv_reports_skips_through_the_logger(caplog, capsys):
209209
210210 assert "No source feature views found" in caplog .text
211211 assert capsys .readouterr ().out == ""
212+ def test_get_historical_features_non_entity_default_end_date_is_utc (tmp_path ):
213+ """With entity_df=None and no end_date, the end bound handed to the provider
214+ must be the current time in UTC. Offline stores read a naive datetime as UTC
215+ (utils.make_tzaware), so a naive local value shifts the window by the host offset."""
216+ from datetime import datetime , timedelta , timezone
217+
218+ from feast import Entity , FeatureView , Field , FileSource
219+ from feast .infra .offline_stores .dask import DaskOfflineStoreConfig
220+ from feast .infra .online_stores .sqlite import SqliteOnlineStoreConfig
221+ from feast .repo_config import RepoConfig
222+ from feast .types import Int64
223+
224+ store = FeatureStore (
225+ config = RepoConfig (
226+ project = "non_entity_default_end_date" ,
227+ registry = str (tmp_path / "registry.db" ),
228+ provider = "local" ,
229+ entity_key_serialization_version = 3 ,
230+ offline_store = DaskOfflineStoreConfig (),
231+ online_store = SqliteOnlineStoreConfig (path = str (tmp_path / "online.db" )),
232+ )
233+ )
234+ driver = Entity (name = "driver" , join_keys = ["driver_id" ])
235+ driver_stats = FeatureView (
236+ name = "driver_stats" ,
237+ entities = [driver ],
238+ ttl = timedelta (days = 1 ),
239+ schema = [Field (name = "driver_id" , dtype = Int64 ), Field (name = "value" , dtype = Int64 )],
240+ source = FileSource (
241+ path = str (tmp_path / "driver_stats.parquet" ),
242+ timestamp_field = "event_timestamp" ,
243+ ),
244+ )
245+ store .apply ([driver , driver_stats ])
246+
247+ provider = MagicMock ()
248+ before = datetime .now (timezone .utc )
249+ with patch .object (FeatureStore , "_get_provider" , return_value = provider ):
250+ store .get_historical_features (entity_df = None , features = ["driver_stats:value" ])
251+ after = datetime .now (timezone .utc )
252+
253+ end_date = provider .get_historical_features .call_args .kwargs ["end_date" ]
254+ assert end_date .utcoffset () == timedelta (0 )
255+ assert before <= utils .make_tzaware (end_date ) <= after
0 commit comments