Wire ComputeEngine.get_historical_features() into the standard retrieval path to replace per-store BFV transformation duplication

Đang mở
#6,359 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python, spark

Hướng nghiên cứu

Bắt đầu với sdk/python/feast/infra/passthrough_provider.py và sdk/python/feast/infra/common/retrieval_task.py, sau đó so sánh ComputeEngine.get_historical_features() với các đường dẫn offline-store của Ray và Spark. Được xem là hoàn thành khi HistoricalRetrievalTask hỗ trợ nhiều view, việc điều phối PIT được chuyển vào compute engine, provider định tuyến việc truy xuất qua batch_engine và logic chuyển đổi BFV bị trùng lặp theo từng store được loại bỏ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

compute_engine

Background

Feast currently has two separate mechanisms for applying BatchFeatureView (BFV) transformations during historical feature retrieval:

  1. Compute Engine DAG path (SparkComputeEngine.get_historical_features(), RayComputeEngine.get_historical_features()) — uses FeatureBuilder + ExecutionPlan with proper node sequencing: source → transform → filter → dedup. This path already handles BFV transformations correctly for both materialization and retrieval.

  2. Offline Store path (passthrough_provider.get_historical_features() → offline_store.get_historical_features()) — the standard path invoked by FeatureStore.get_historical_features(). This path bypasses the compute engine entirely.

Because of this split, each offline store that wants BFV compute-on-read during historical retrieval must re-implement transformation detection and application logic independently:

  • RayOfflineStore.get_historical_features() implements it via resolve_feature_view_source_with_fallback() + map_batches()
  • PR #6357 adds a parallel implementation for SparkOfflineStore

This means transformation logic is duplicated across stores rather than living in the shared compute engine layer.

Root Cause

passthrough_provider.get_historical_features() always delegates to self.offline_store, never to self.batch_engine:

# sdk/python/feast/infra/passthrough_provider.py
def get_historical_features(self, config, feature_views, ...):
    job = self.offline_store.get_historical_features(...)  # batch_engine never called
    return job

Note the contrast with materialization, which correctly routes through the engine:

jobs = self.batch_engine.materialize(registry, task)

Blocking Interface Mismatch

The compute engine cannot be directly substituted today because of a fundamental impedance mismatch:

  • passthrough_provider.get_historical_features() receives feature_views: List[FeatureView] — multiple views for a single multi-view PIT join
  • HistoricalRetrievalTask (the compute engine's input) has feature_view: Union[BatchFeatureView, StreamFeatureView] — a single view
# sdk/python/feast/infra/common/retrieval_task.py
@dataclass
class HistoricalRetrievalTask:
    feature_view: Union[BatchFeatureView, StreamFeatureView]  # singular
    entity_df: Union[pd.DataFrame, str]
    ...

The compute engine is designed for per-view DAG execution. The PIT join logic that combines multiple views into one entity-aligned training dataset lives in each offline store's SQL template, not in the compute engine.

Proposed Solution

This is a multi-step refactor:

Step 1 — Extend HistoricalRetrievalTask to support multiple feature views:

@dataclass
class HistoricalRetrievalTask:
    feature_views: List[Union[BatchFeatureView, FeatureView]]  # plural
    entity_df: Union[pd.DataFrame, str]
    feature_refs: List[str]

Step 2 — Move PIT join coordination into ComputeEngine.get_historical_features():

The base ComputeEngine should orchestrate per-view DAG execution across all requested feature views and join the results back to entity_df — making the PIT join logic engine-owned rather than SQL-template-owned.

Step 3 — Wire the provider to call batch_engine for historical retrieval:

# passthrough_provider.py
def get_historical_features(self, config, feature_views, feature_refs, entity_df, ...):
    task = HistoricalRetrievalTask(
        feature_views=feature_views,
        feature_refs=feature_refs,
        entity_df=entity_df,
        ...
    )
    return self.batch_engine.get_historical_features(registry, task)

Step 4 — Retire per-store transformation logic:

Once the compute engine owns this path, the custom BFV transformation code in RayOfflineStore and SparkOfflineStore can be removed. All stores get transformation support for free through the engine's FeatureBuilder.

Ngôn ngữ chính
Python
Star
7.4k
Fork
1.5k
Merge trung bình
2 ngày 6 giờ
Pull request đã merge (30 ngày)
107

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của feast-dev/feast

Tất cả issue của feast-dev/feast

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.