Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/getting-started/concepts/feature-retrieval.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ training_df = store.get_historical_features(
If `start_date` is omitted, it defaults to `end_date` minus the feature view TTL. If `end_date` is omitted, it defaults to the current time. Point-in-time correctness is still preserved.

{% hint style="warning" %}
Entity-less retrieval is currently supported for the **Postgres**, **Dask**, **Spark**, **Ray**, and **Trino** offline stores. You cannot mix `entity_df` with `start_date`/`end_date` in the same call.
Entity-less retrieval is currently supported for the **Postgres**, **Dask**, **Spark**, **Ray**, **Trino**, and **Couchbase Columnar** offline stores. You cannot mix `entity_df` with `start_date`/`end_date` in the same call.
{% endhint %}

For more details, see the [FAQ](../faq.md#how-do-i-run-get_historical_features-without-providing-an-entity-dataframe) and [this blog post on entity-less historical feature retrieval](https://feast.dev/blog/entity-less-historical-features-retrieval/).
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Yes, this is possible. For example, you can use BigQuery as an offline store and

Feast does support fetching historical features without passing an entity dataframe with the request.

- **Supported offline stores:** Entity-less (entity dataframe–less) retrieval is supported for the **Postgres**, **Dask**, **Spark**, **Ray**, and **Trino** offline stores. Postgres was the first to support it; Dask, Spark, Ray, and Trino have followed. Other offline stores may be added based on priority and community demand.
- **Supported offline stores:** Entity-less (entity dataframe–less) retrieval is supported for the **Postgres**, **Dask**, **Spark**, **Ray**, **Trino**, and **Couchbase Columnar** offline stores. Postgres was the first to support it; Dask, Spark, Ray, Trino, and Couchbase Columnar have followed. Other offline stores may be added based on priority and community demand.
- **Date range:** Retrieval is controlled by the `start_date` and `end_date` parameters. Supported combinations:
- Both params given → data in the given start-to-end time range.
- Only `start_date` given → data from the start date to now.
Expand Down
1 change: 1 addition & 0 deletions docs/reference/offline-stores/couchbase.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

The Couchbase Columnar offline store provides support for reading [CouchbaseColumnarSources](../data-sources/couchbase.md). **Note that Couchbase Columnar is available through [Couchbase Capella](https://cloud.couchbase.com/).**
* Entity dataframes can be provided as a SQL++ query or can be provided as a Pandas dataframe. A Pandas dataframe will be uploaded to Couchbase Capella Columnar as a collection.
* Historical features can also be retrieved without an entity dataframe by passing `start_date` and/or `end_date` to `get_historical_features`. Every entity key with an event between `start_date` and `end_date` is joined as of `end_date`, so each entity gets its latest feature values within the feature view TTL. No collection is created in this mode. See [entity-less retrieval](../../getting-started/concepts/feature-retrieval.md) for details.

## Disclaimer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from feast.on_demand_feature_view import OnDemandFeatureView
from feast.repo_config import FeastConfigBaseModel, RepoConfig
from feast.saved_dataset import SavedDatasetStorage
from feast.utils import compute_non_entity_date_range

from ... import offline_utils
from ...offline_utils import get_timestamp_filter_sql
Expand Down Expand Up @@ -134,11 +135,12 @@ def get_historical_features(
config: RepoConfig,
feature_views: List[FeatureView],
feature_refs: List[str],
entity_df: Union[pd.DataFrame, str],
entity_df: Optional[Union[pd.DataFrame, str]],
registry: BaseRegistry,
project: str,
full_feature_names: bool = False,
filter_by_created_timestamp: bool = False,
**kwargs: Any,
) -> RetrievalJob:
"""
Retrieve historical features using point-in-time joins.
Expand All @@ -152,6 +154,19 @@ def get_historical_features(
for fv in feature_views:
assert isinstance(fv.batch_source, CouchbaseColumnarSource)

if entity_df is None:
return _get_historical_features_without_entity_df(
config=config,
feature_views=feature_views,
feature_refs=feature_refs,
registry=registry,
project=project,
full_feature_names=full_feature_names,
filter_by_created_timestamp=filter_by_created_timestamp,
start_date=kwargs.get("start_date"),
end_date=kwargs.get("end_date"),
)
Comment on lines +157 to +168

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Missing required universal retrieval coverage

The new entity_df is None path has only mocked unit coverage. The component rules require a universal integration case for retrieval changes. Existing entity-less integration cases exclude Couchbase, leaving generated SQL and returned values untested against this backend.

Learn more

The component checklist requires a universal integration test for retrieval changes. The existing basic non-entity integration test runs only for Ray, while historical non-entity retrieval coverage restricts its corresponding case to the file store. The added unit tests inspect generated SQL or supply mocked query results, so they cannot validate SQL++ execution semantics.

Example: A generated cutoff can pass every SQL substring assertion while excluding the latest eligible event when Couchbase executes the query.

Recommended fix: Add a universal integration case enabled for Couchbase that retrieves without an entity dataframe and asserts actual entity keys, feature values, and timestamps. Include inclusive date boundaries and field mappings, and run the required local integration suite.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.


entity_schema = _get_entity_schema(entity_df, config)

entity_df_event_timestamp_col = (
Expand Down Expand Up @@ -468,6 +483,125 @@ def _get_entity_df_event_timestamp_range(
return entity_df_event_timestamp_range


def _get_historical_features_without_entity_df(
config: RepoConfig,
feature_views: List[FeatureView],
feature_refs: List[str],
registry: BaseRegistry,
project: str,
full_feature_names: bool,
filter_by_created_timestamp: bool,
start_date: Optional[datetime],
end_date: Optional[datetime],
) -> RetrievalJob:
"""
Retrieves historical features for a time range instead of an entity dataframe.

The left side of the point-in-time join is built from the entity keys observed
in the feature view sources between start_date and end_date, each joined as of
end_date, so every entity gets its latest feature values within the TTL.
"""
start_date, end_date = compute_non_entity_date_range(
feature_views,
start_date=start_date,
end_date=end_date,
)

query_context = offline_utils.get_feature_view_query_context(
feature_refs,
feature_views,
registry,
project,
(start_date, end_date),
)

entity_df_event_timestamp_col = offline_utils.DEFAULT_ENTITY_DF_EVENT_TIMESTAMP_COL
join_keys = offline_utils.gather_all_entities(query_context)
entity_df_columns = {
column: None for column in join_keys + [entity_df_event_timestamp_col]
}.keys()

query = build_point_in_time_query(
[asdict(context) for context in query_context],
left_table_query_string=_build_non_entity_left_table_query(
query_context=query_context,
join_keys=join_keys,
start_date=start_date,
end_date=end_date,
entity_df_event_timestamp_col=entity_df_event_timestamp_col,
),
entity_df_event_timestamp_col=entity_df_event_timestamp_col,
entity_df_columns=entity_df_columns,
query_template=MULTIPLE_FEATURE_VIEW_POINT_IN_TIME_JOIN,
full_feature_names=full_feature_names,
filter_by_created_timestamp=filter_by_created_timestamp,
)

return CouchbaseColumnarRetrievalJob(
query=query,
config=config,
full_feature_names=full_feature_names,
on_demand_feature_views=OnDemandFeatureView.get_requested_odfvs(
feature_refs, project, registry
),
metadata=RetrievalMetadata(
features=feature_refs,
keys=join_keys,
min_event_timestamp=start_date,
max_event_timestamp=end_date,
),
timestamp_field=entity_df_event_timestamp_col,
)


def _build_non_entity_left_table_query(
query_context: List[offline_utils.FeatureViewQueryContext],
join_keys: List[str],
start_date: datetime,
end_date: datetime,
entity_df_event_timestamp_col: str,
) -> str:
"""
Builds a subquery that stands in for the entity dataframe in non-entity mode.

It selects the distinct join keys of every feature view with entities whose
source has events between start_date and end_date, fills the join keys a
feature view does not have with null, and sets the event timestamp of every
row to end_date. Feature views without entities join on the timestamp alone,
so they do not contribute rows. When no feature view has entities, the
subquery is a single row holding end_date.
"""
start_timestamp = normalize_timestamp(start_date)
end_timestamp = normalize_timestamp(end_date)
Comment on lines +574 to +575

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Truncated cutoff drops boundary events

With fractional-second end_date, normalize_timestamp truncates the synthetic cutoff, excluding valid events in that second. The string upper bound also excludes same-second timestamps formatted by df_to_columnar, even at an exact-second cutoff. Retrieval silently omits entities or returns older features.

Learn more

The default normalize_timestamp format omits fractional seconds and emits a compact UTC offset. The synthetic entity timestamp now uses that format for both source filtering and the point-in-time cutoff. In contrast, df_to_columnar writes fractional seconds with a colon-separated UTC offset. SQL++ string comparisons do not normalize these representations: a fractional timestamp sorts after the same-second cutoff because . sorts after +. The point-in-time template also compares source timestamps directly against the synthetic cutoff.

Example: With end_date=2025-07-10T12:00:00.750000+00:00, an event stored as 2025-07-10T12:00:00.500000+00:00 precedes the requested end. The generated upper bound is 2025-07-10T12:00:00+0000, so the event fails the string comparison. If that is the entity's only event in the range, the entity disappears entirely.

Recommended fix: Preserve microseconds in the synthetic timestamp and normalize source timestamps and bounds to comparable temporal values or a consistent canonical representation. Cover fractional cutoffs and exact inclusive boundaries using timestamps in the format written by df_to_columnar.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

event_timestamp_col = _escape_column(entity_df_event_timestamp_col)

entity_selects = []
for context in query_context:
if not context.entities:
continue
selections = dict(zip(context.entities, context.entity_selections))
columns = ", ".join(
selections.get(join_key, f"null AS {join_key}") for join_key in join_keys
)
entity_selects.append(
f"SELECT {columns} "
f"FROM {context.table_subquery} AS sub "
f"WHERE sub.{_escape_column(context.timestamp_field)} "
f"BETWEEN '{start_timestamp}' AND '{end_timestamp}'"
)

if not entity_selects:
return f"(SELECT '{end_timestamp}' AS {event_timestamp_col})"

entity_union = "\n UNION ALL\n ".join(entity_selects)
return f"""(
SELECT DISTINCT entity_keys.*, '{end_timestamp}' AS {event_timestamp_col}
FROM (
{entity_union}
) AS entity_keys
)"""


def _escape_column(column: str) -> str:
"""Wrap column names in backticks to handle reserved words."""
return f"`{column}`"
Expand Down
Loading
Loading