Skip to content

hsfs.constructor.lookback #

FeatureGroupLookback #

A lookback window for point-in-time joins on a feature view.

A lookback bounds how far back in time the joined feature group(s) may contribute rows to a point-in-time join, so partition scans stay bounded as feature groups grow.

Use key="PARTITION_KEY" when the feature group is partitioned by a DATE column aligned with the lookback bounds; the storage engine then prunes whole partitions before reading any files. Use key="EVENT_TIME" to bound on the event-time column; the result is always correct, but whether the engine can also prune files depends on the storage format.

Use this class for a uniform window across every feature group in the view; use Lookback when different feature groups need different windows.

Example
fv.get_batch_data(
    lookback=FeatureGroupLookback(
        key="PARTITION_KEY",
        start=date(2026, 5, 5),
        end=date(2026, 5, 17),
    ),
)

key property #

key: str

Column the lookback predicate targets on each joined feature group.

One of "PARTITION_KEY" or "EVENT_TIME".

start property #

start: date | datetime | int | str

Lower bound of the lookback window (inclusive).

end property #

end: date | datetime | int | str | None

Upper bound of the lookback window (inclusive), or None for an open-ended upper side.

Lookback #

Per-feature-group lookback windows for a point-in-time-joined feature view.

default applies to every feature group in the view (root and joined) that does not have a matching feature_group_lookbacks override. feature_group_lookbacks maps a specific feature group to its own lookback, which wins over the default for that feature group. At least one of default or feature_group_lookbacks must be set.

If default is omitted, feature groups not listed in feature_group_lookbacks are read without any lookback (same as not passing lookback=...).

Use FeatureGroupLookback directly for a uniform window across every feature group in the view.

feature_group_lookbacks keys identify the feature group in one of two ways:

  • "name" — matches every feature group with that name, regardless of version. Covers the common case where each feature group appears once in the view.
  • Feature group instance — matches a specific (name, version). Use this when the view joins two versions of the same feature group.

If you supply both a name string and a feature group instance that resolve to the same name, the instance entry wins for its specific version and the name entry applies to the other versions.

Feature group instances are not JSON-serializable; if you need to persist this configuration, use name strings as keys.

Example
fv.get_batch_data(
    lookback=Lookback(
        default=FeatureGroupLookback(key="PARTITION_KEY", start=date(2026, 5, 5)),
        feature_group_lookbacks={
            "transactions": FeatureGroupLookback(key="EVENT_TIME",
                                     start=datetime(2026, 5, 1, tzinfo=timezone.utc)),
        },
    ),
)

default property #

default: FeatureGroupLookback | None

FeatureGroupLookback applied to every feature group without a feature_group_lookbacks override.

feature_group_lookbacks property #

feature_group_lookbacks: dict[Any, FeatureGroupLookback]

Per-feature-group overrides keyed by feature group name or instance.