-
Notifications
You must be signed in to change notification settings - Fork 998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use FeatureViewProjection instead of FeatureView in ODFV #2186
Use FeatureViewProjection instead of FeatureView in ODFV #2186
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2186 +/- ##
==========================================
- Coverage 84.55% 84.44% -0.11%
==========================================
Files 104 104
Lines 8286 8255 -31
==========================================
- Hits 7006 6971 -35
- Misses 1280 1284 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
87a0469
to
bad65c1
Compare
bad65c1
to
5bfd7fd
Compare
cb1cd2c
to
5e45b47
Compare
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
5e45b47
to
7d40161
Compare
map<string, OnDemandInput> inputs = 4; | ||
|
||
// Map of projections for the inputs of this feature view. | ||
// Keys must also be present in `inputs` | ||
map<string, FeatureViewProjection> projections = 6; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we add FeatureViewProjection
in the OnDemandInput
oneof? And remove the feature view if you so wish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up avoiding doing this because this retrieves the entities of the backing FeatureViews.
Line 287 in 7d4369f
for backing_fv in feature_view.inputs.values(): |
This can't be done if a FeatureView Projection is store instead of the FeatureView.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm should we look up the entites expicitly via the feature view name, if it's just in that method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be worried to have two fields in the proto which have this weird dependency between each other, and would prefer a single field - and it feels like we should be able to get away with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I'll take another pass at doing that tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ended up being quite a bit more involved.
The changes in this PR definitely reduce the number of calls to the OnlineStore in the simple case of Features being requested from 'an ODFV which depends on a projection of a FV' and from the unprojected version of that FV (1 call rather than 2 and only the required features).
However, when multiple different Projections are used in a FeatureService I'm not 100% we won't end up making multiple calls to the OnlineStore for each Projection + the projection used by the ODFV.
I'm also not 100% we catch the case where 2 ODFVs used different projections of the same FV.
But I do think this approach of working out what we need before starting to request things from the OnlineStore is better than it was.
…ions in ODFVs. Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
…ection Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
@achals I've tacked on some additional changes here which improve the performance of It looks like there may still be a few issues but hopefully will get them solved quickly. |
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
28a29b9
to
39cb7b3
Compare
30cdd2d
to
6ef9773
Compare
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
6ef9773
to
2548800
Compare
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
2548800
to
1d20807
Compare
@achals All the tests other than the ones that are failing on Do you think you could give this another review and look at merging? |
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Nit, release notes are a bit unclear:
|
Reworded those two. |
def __eq__(self, other): | ||
if not super().__eq__(other): | ||
return False | ||
|
||
if ( | ||
not self.input_feature_view_projections | ||
== other.input_feature_view_projections | ||
): | ||
return False | ||
|
||
if not self.input_request_data_sources == other.input_request_data_sources: | ||
return False | ||
|
||
if not self.udf.__code__.co_code == other.udf.__code__.co_code: | ||
return False | ||
|
||
return True | ||
|
||
def __hash__(self): | ||
return super().__hash__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why these needed to be added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default only the name
and features
properties are checked. This seemed obviously wrong to me... You could change the inputs and UDF but keep the outputs and name the same.
feast/sdk/python/feast/base_feature_view.py
Lines 105 to 117 in 30f7bba
def __eq__(self, other): | |
if not isinstance(other, BaseFeatureView): | |
raise TypeError( | |
"Comparisons should only involve BaseFeatureView class objects." | |
) | |
if self.name != other.name: | |
return False | |
if sorted(self.features) != sorted(other.features): | |
return False | |
return True |
Then is __eq__
is overridden __hash__
also has to be! Annoying but true.
https://docs.python.org/3/reference/datamodel.html#object.__hash__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I remember that __hash__
has to be overridden too - okay cool makes sense.
elif on_demand_input.WhichOneof("input") == "feature_view_projection": | ||
inputs[input_name] = FeatureViewProjection.from_proto( | ||
on_demand_input.feature_view_projection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that fv inputs will be converted from a feature view
to a projection
when feast apply runs for existing feature repos?
I wonder what the output of feast plan
looks like in that case, if anything has changed. If the change does appear, we probably should keep that in mind and update the release notes to have users expect it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe they should be updated the next time that feast apply
is run. The diff is 'large' but makes sense. I'd also suggest maybe this isn't a big deal as the ODFVs are still labelled as Alpha (and I think will need some iteration as calling either to_dict
or to_df
for them isn't terribly performant).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fair I don't really want to block this change on the perceived change, but maybe it should be something we call out in the release notes (or the blog post about the release).
@@ -99,65 +88,3 @@ def to_df(self) -> pd.DataFrame: | |||
""" | |||
|
|||
return pd.DataFrame(self.to_dict()) | |||
|
|||
|
|||
def _infer_online_entity_rows( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
love seeing red
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: achals, judahrand The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Judah Rand 17158624+judahrand@users.noreply.github.com
What this PR does / why we need it:
Before this PR if an ODFV feature is requested then all Features from FeatureView dependencies must be retrieved. This is not performant for FeatureViews which are very wide but with few required features.
This change allows the following spelling to require only a subset of features:
This can dramatically reduce serving latency of ODFVs in some cases.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: