Skip to content

Commit

Permalink
corrections based on CR comments
Browse files Browse the repository at this point in the history
Signed-off-by: David Y Liu <[email protected]>
  • Loading branch information
mavysavydav committed Oct 4, 2021
1 parent 659374a commit 31cd6a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion sdk/python/feast/feature_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 12 additions & 4 deletions sdk/python/feast/feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."
)

Expand Down

0 comments on commit 31cd6a8

Please sign in to comment.