diff --git a/sdk/python/feast/feature_service.py b/sdk/python/feast/feature_service.py index 628c706263..9f8e9af1fb 100644 --- a/sdk/python/feast/feature_service.py +++ b/sdk/python/feast/feature_service.py @@ -64,7 +64,10 @@ def __init__( ): self.feature_view_projections.append(feature_grouping.projection) else: - raise ValueError(f"Unexpected type: {type(feature_grouping)}") + raise ValueError( + "The FeatureService {fs_name} has been provided with an invalid type" + f'{type(feature_grouping)} as part of the "features" argument.)' + ) self.tags = tags or {} self.description = description diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py index 65c727e979..9752449c59 100644 --- a/sdk/python/feast/feature_view.py +++ b/sdk/python/feast/feature_view.py @@ -391,19 +391,27 @@ def infer_features_from_batch_source(self, config: RepoConfig): def set_projection(self, feature_view_projection: FeatureViewProjection) -> None: """ - Setter for the projection object held by this FeatureView. Performs checks to ensure - the projection is consistent with this FeatureView before doing the set. + Setter for the projection object held by this FeatureView. A projection is an + object that stores the modifications to a FeatureView that is applied to the FeatureView + when the FeatureView is used such as during feature_store.get_historical_features. + This method also performs checks to ensure the projection is consistent with this + FeatureView before doing the set. Args: feature_view_projection: The FeatureViewProjection object to set this FeatureView's 'projection' field to. """ - assert feature_view_projection.name == self.name + if feature_view_projection.name != self.name: + raise ValueError( + f"The projection for the {self.name} FeatureView cannot be applied because it differs in name. " + f"The projection is named {feature_view_projection.name} and the name indicates which " + "FeatureView the projection is for." + ) for feature in feature_view_projection.features: if feature not in self.features: raise ValueError( - f"The projection for {self.name} cannot be applied because it contains {feature.name} which the" + f"The projection for {self.name} cannot be applied because it contains {feature.name} which the " "FeatureView doesn't have." )