Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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: 2 additions & 0 deletions sdk/python/feast/templates/spark/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def bootstrap():
driver_stats_df.to_parquet(
path=str(data_path / "driver_hourly_stats.parquet"),
allow_truncated_timestamps=True,
coerce_timestamps="us",
)

customer_entities = [201, 202, 203]
Expand All @@ -30,6 +31,7 @@ def bootstrap():
customer_profile_df.to_parquet(
path=str(data_path / "customer_daily_profile.parquet"),
allow_truncated_timestamps=True,
coerce_timestamps="us",
)


Expand Down
10 changes: 2 additions & 8 deletions sdk/python/feast/templates/spark/feature_repo/example_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@


# Entity definitions
driver = Entity(
name="driver",
description="driver id",
)
customer = Entity(
name="customer",
description="customer id",
)
driver = Entity(name="driver", description="driver id", join_keys=["driver_id"])
customer = Entity(name="customer", description="customer id", join_keys=["customer_id"])

# Sources
driver_hourly_stats = SparkSource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def fetch_historical_features_entity_df(store: FeatureStore, for_batch_scoring:
"driver_hourly_stats:conv_rate",
"driver_hourly_stats:acc_rate",
"driver_hourly_stats:avg_daily_trips",
"transformed_conv_rate:conv_rate_plus_val1",

Choose a reason for hiding this comment

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

did you mean to remove these? I think you use them later.

"transformed_conv_rate:conv_rate_plus_val2",
],
).to_df()
print(training_df.head())
Expand All @@ -109,8 +107,6 @@ def fetch_online_features(store, use_feature_service: bool):
features_to_fetch = [
"driver_hourly_stats:acc_rate",
"driver_hourly_stats:avg_daily_trips",
"transformed_conv_rate:conv_rate_plus_val1",

Choose a reason for hiding this comment

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

Oh these didn't work?

Copy link
Author

@Felix-neko Felix-neko May 31, 2025

Choose a reason for hiding this comment

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

This on-the-fly feature was not declared in the example feature repo for Spark and i have just removed it from this example.

Choose a reason for hiding this comment

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

Looking at the code under aws/feature_repo/example_repo.py had this ODFV:

# Define an on demand feature view which can generate new features based on
# existing feature views and RequestSource features
@on_demand_feature_view(
    sources=[driver_stats_fv, input_request],
    schema=[
        Field(name="conv_rate_plus_val1", dtype=Float64),
        Field(name="conv_rate_plus_val2", dtype=Float64),
    ],
)
def transformed_conv_rate(inputs: pd.DataFrame) -> pd.DataFrame:
    df = pd.DataFrame()
    df["conv_rate_plus_val1"] = inputs["conv_rate"] + inputs["val_to_add"]
    df["conv_rate_plus_val2"] = inputs["conv_rate"] + inputs["val_to_add_2"]
    return df

Copy link
Author

Choose a reason for hiding this comment

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

Great, it works. I've restored it.

"transformed_conv_rate:conv_rate_plus_val2",
]
returned_features = store.get_online_features(
features=features_to_fetch,
Expand Down