Skip to content
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

Fix bug causing OnDemandFeatureView.infer_features() to fail when the… #2046

Merged
merged 3 commits into from
Nov 18, 2021

Conversation

ArrichM
Copy link
Contributor

@ArrichM ArrichM commented Nov 16, 2021

What this PR does / why we need it:
Problem:
When running OnDemandFeatureView.infer_features() and there are features registered with labels, an RegistryInferenceFailure is raised.

Currently, this will work as-is:

import feast
import pandas as pd

@feast.on_demand_feature_view.on_demand_feature_view(
    inputs={},
    features=[
        feast.Feature(name="not_labeled", dtype=feast.ValueType.DOUBLE)
    ],
)
def not_labeled_view(feature_df: pd.DataFrame) -> pd.DataFrame:
    df = pd.DataFrame(dtype="float", columns=["not_labeled"])
    return df

not_labeled_view.infer_features()

While this won't:

import feast
import pandas as pd

@feast.on_demand_feature_view.on_demand_feature_view(
    inputs={},
    features=[
        feast.Feature(name="not_labeled", dtype=feast.ValueType.DOUBLE, labels={"test": "label"})
    ],
)
def labeled_view(feature_df: pd.DataFrame) -> pd.DataFrame:
    df = pd.DataFrame(dtype="float", columns=["labeled"])
    return df

labeled_view.infer_features()

Suggested Fix:
To allow features with labels in the OnDemandFeatureView definition, remove labels from the registered features when comparing infered features with registered ones.

Do not include labels when checking equality of Features.

Does this PR introduce a user-facing change?:

None

…re are labels present in the features that are registered in the on-deamnd-feature-view definition.

Signed-off-by: ArrichM <maximilianjakob.arrich@student.unisg.ch>
@feast-ci-bot
Copy link
Collaborator

@ArrichM: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@feast-ci-bot
Copy link
Collaborator

Hi @ArrichM. Thanks for your PR.

I'm waiting for a feast-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@adchia
Copy link
Collaborator

adchia commented Nov 17, 2021

/ok-to-test

@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2021

Codecov Report

Merging #2046 (e1017ac) into master (dc46a96) will decrease coverage by 0.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2046      +/-   ##
==========================================
- Coverage   83.70%   83.41%   -0.30%     
==========================================
  Files         100      100              
  Lines        8028     8029       +1     
==========================================
- Hits         6720     6697      -23     
- Misses       1308     1332      +24     
Flag Coverage Δ
integrationtests 74.16% <100.00%> (-0.30%) ⬇️
unittests 57.54% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdk/python/feast/on_demand_feature_view.py 95.04% <100.00%> (+0.04%) ⬆️
sdk/python/feast/infra/aws.py 72.59% <0.00%> (-11.06%) ⬇️
.../integration/online_store/test_universal_online.py 97.67% <0.00%> (-0.47%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dc46a96...e1017ac. Read the comment docs.

Signed-off-by: ArrichM <maximilianjakob.arrich@student.unisg.ch>
@achals
Copy link
Member

achals commented Nov 18, 2021

Thanks for the PR @ArrichM! I think your approach would work, but I'm wondering if a better fix would be to update https://github.com/feast-dev/feast/blob/master/sdk/python/feast/feature.py#L50 and remove the line

            or self.labels != other.labels

Since that would fix these kinds of comparisons more generally. What do you think?

Signed-off-by: ArrichM <maximilianjakob.arrich@student.unisg.ch>
@ArrichM
Copy link
Contributor Author

ArrichM commented Nov 18, 2021

Yes, that was also what I came up with originally, but then I was hesitant to introduce this change globally.

Copy link
Member

@achals achals left a comment

Choose a reason for hiding this comment

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

/lgtm

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: achals, ArrichM

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@feast-ci-bot feast-ci-bot merged commit 8d9b831 into feast-dev:master Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants