Repository navigation
feat: Retrieve historical features from Trino without an entity dataframe - #7150
Merged
ntkathole merged 1 commit intoNov 14, 2026
Merged
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7150 +/- ##
=======================================
Coverage 52.45% 52.45%
=======================================
Files 459 459
Lines 58172 58172
Branches 8577 8577
=======================================
Hits 30515 30515
Misses 25573 25573
Partials 2084 2084
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
franciscojavierarceo
approved these changes
Nov 13, 2026
…rame TrinoOfflineStore.get_historical_features did not accept start_date or end_date, so calling FeatureStore.get_historical_features without an entity_df failed with "unexpected keyword argument 'start_date'" on Trino. When entity_df is None, build the left side of the point-in-time join from the data itself: a UNION of the distinct join keys that each feature view source has between start_date and end_date, with every row stamped at end_date. Each entity then gets its latest feature values within the TTL, matching the BigQuery and Spark offline stores. The entity subquery is inlined into the existing point-in-time template, so no temporary table is created and read-only catalogs work. It selects through the query context's entity selections and timestamp field, so field mappings and join key projections are honoured. Join keys a feature view does not have are filled with NULL, feature views without entities join on the timestamp only, and when no feature view has entities the left side is a single row at end_date. start_date and end_date default through compute_non_entity_date_range like the other stores. Document entity-less retrieval for Trino in the offline store reference, the feature retrieval concepts page and the FAQ. Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
ntkathole
force-pushed
the
feat/trino-non-entity-retrieval
branch
from
November 14, 2026 03:36
aa9a31a to
c219fb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Trino didn't support entity-less historical retrieval.
TrinoOfflineStore.get_historical_featuresdidn't acceptstart_dateorend_date, so this failed:This PR adds a non-entity mode that works the same way as in the BigQuery and Spark offline stores. When
entity_dfisNone, the left side of the point-in-time join is built from the data:UNIONof the distinct join keys found in each feature view source betweenstart_dateandend_date.end_date, so each entity gets its latest feature values within the TTL.Details:
MULTIPLE_FEATURE_VIEW_POINT_IN_TIME_JOINtemplate. No temporary table is created, so the mode also works on read-only catalogs and there is nothing to clean up.custmapped tocustomer_idbecomescust AS customer_id. Query-basedTrinoSources are wrapped in parentheses.NULLin its rows. Feature views without entities don't add rows, because they join on the timestamp only. If no feature view has entities, the left side is a single row atend_date.start_dateandend_dateget their defaults fromcompute_non_entity_date_range, like in the other stores.filter_by_created_timestamp,full_feature_namesand on-demand feature views work as they do in entity-df mode.from_iso8601_timestamp('...+00:00')), so they don't depend on the session time zone.Docs: the Trino offline store reference now describes the mode. Trino is added to the list of supported stores on the feature retrieval concepts page and in the FAQ.
Which issue(s) this PR fixes:
Fixes #5840
Checks
git commit -s)Testing Strategy
Unit tests (
tests/unit/infra/offline_stores/contrib/trino_offline_store/test_trino_non_entity_mode.py) cover:NULLfilling across feature views, skipping feature views without entities, the single-row case, and UTC conversion;get_historical_featuresflow: no upload and no temporary table, final column list, metadata,start_datedefault, andfilter_by_created_timestamp;The new tests fail on
master. The existing Trino unit tests still pass.ruff check,ruff format --checkandmypyontrino.pyare clean.Manual end-to-end test against
trinodb/trino:376(the image used by the Trino test data source) with the memory connector:end_date. An entity with no events in the range was left out.end_dateworked.full_feature_names=True.filter_by_created_timestamp=Trueworked.TrinoSourceworked.On
masterthe same script fails with theTypeErrorabove.Misc