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

Handle case where_LIST type is empty #1703

Merged
merged 18 commits into from
Sep 21, 2021

Conversation

judahrand
Copy link
Member

@judahrand judahrand commented Jul 11, 2021

What this PR does / why we need it:
This PR deals with multiple issues around empty list features regarding type inference.

It is my opinion that these fixes should be somewhat of a stop gap and that really the way that types are dealt with should be overhauled in Feast.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Fix issue which prevented empty lists being materialized into online stores or retrieved from historical stores.

@feast-ci-bot
Copy link
Collaborator

Hi @judahrand. 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.

@judahrand
Copy link
Member Author

Fixes an issue mentioned in #1640 but not the whole issue as this does not deal with int lists.

@woop
Copy link
Member

woop commented Jul 11, 2021

Thanks @judahrand, should we perhaps add a test to ensure that the change you've introduced works?

@codecov-commenter
Copy link

codecov-commenter commented Jul 11, 2021

Codecov Report

Merging #1703 (69e43ac) into master (21f1ef7) will decrease coverage by 0.20%.
The diff coverage is 40.86%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1703      +/-   ##
==========================================
- Coverage   62.29%   62.09%   -0.21%     
==========================================
  Files          96       96              
  Lines        7363     7424      +61     
==========================================
+ Hits         4587     4610      +23     
- Misses       2776     2814      +38     
Flag Coverage Δ
unittests 62.09% <40.86%> (-0.21%) ⬇️

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

Impacted Files Coverage Δ
...s/integration/registration/test_universal_types.py 35.41% <18.60%> (-5.82%) ⬇️
sdk/python/tests/data/data_creator.py 34.78% <33.33%> (-3.32%) ⬇️
sdk/python/feast/feature.py 74.24% <50.00%> (-0.76%) ⬇️
sdk/python/feast/type_map.py 51.53% <54.16%> (+3.26%) ⬆️
sdk/python/feast/online_response.py 84.90% <71.42%> (-7.60%) ⬇️
sdk/python/tests/conftest.py 70.31% <0.00%> (-1.57%) ⬇️

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 21f1ef7...69e43ac. Read the comment docs.

@judahrand
Copy link
Member Author

Hey @woop. Took me a while to get to this but it is easier now that the tests have been reworked a tad. Added the test you asked for. Worth revisiting?

@judahrand
Copy link
Member Author

judahrand commented Sep 17, 2021

Wanted to go back and get the integration tests to run with the code from master + my test to make sure this is actually still broken. Also to see if those tests that failed a second ago were just flakey.

Looks like I need approval to run them again... @achals

@judahrand
Copy link
Member Author

judahrand commented Sep 17, 2021

Wanted to go back and get the integration tests to run with the code from master + my test to make sure this is actually still broken. Also to see if those tests that failed a second ago were just flakey.

Looks like I need approval to run them again... @achals

I think you might have to unlabel and re-label ok-to-test? I would run them locally but they seem to fail even with no changes on my system (possibly macOS related 🤷‍♂️ )

@judahrand judahrand closed this Sep 17, 2021
@judahrand judahrand reopened this Sep 17, 2021
@judahrand
Copy link
Member Author

Hmmm... Maybe I'm wrong... Any idea why the integration tests are skipping?

@adchia
Copy link
Collaborator

adchia commented Sep 19, 2021

Re python_type_to_feast_value_type:

What are the downsides to relaxing the null constraint on inference in this method? It seems relatively normal to have some feature values be null / empty e.g. a user history feature for a new user.

@judahrand
Copy link
Member Author

Re python_type_to_feast_value_type:

What are the downsides to relaxing the null constraint on inference in this method? It seems relatively normal to have some feature values be null / empty e.g. a user history feature for a new user.

What would you suggest it should return? ValueType.UNKNOWN? I'm not sure what the downstream consequences of that might be?

@adchia
Copy link
Collaborator

adchia commented Sep 19, 2021

I think ValueType.UNKNOWN would probably throw an error since we need some type, and presumably it got here in many cases because there was no supplied type (e.g. "inference" code)

[120, null, 1, 3, 4], I'd expect that to still infer to an int list that we'd want to support.

There's likely downstream effects of asserting that though, though I think the only real store we "support" right now is BQ and materialization crashes there (#1839)

@judahrand
Copy link
Member Author

I think ValueType.UNKNOWN would probably throw an error since we need some type, and presumably it got here in many cases because there was no supplied type (e.g. "inference" code)

Agreed.

[120, null, 1, 3, 4], I'd expect that to still infer to an int list that we'd want to support.

There's likely downstream effects of asserting that though, though I think the only real store we "support" right now is BQ and materialization crashes there (#1839)

Yup, that's the approach I'm trying here: infer type from all the data provided rather than infer a type for each piece of data alone. This'll still fail in the case where all the data is empty lists (or all null) which isn't great in my opinion given that there is an underlying schema from the data source (at least for the DB sources).

Should we not be inferring types from the schema rather than the data really?

Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
@judahrand
Copy link
Member Author

judahrand commented Sep 19, 2021

Tests pass!

Actually, for realz ready to be reviewed now @adchia

Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
sdk/python/feast/type_map.py Outdated Show resolved Hide resolved
sdk/python/feast/feature.py Outdated Show resolved Hide resolved
sdk/python/feast/online_response.py Show resolved Hide resolved
sdk/python/tests/data/data_creator.py Outdated Show resolved Hide resolved
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
sdk/python/feast/online_response.py Outdated Show resolved Hide resolved
sdk/python/feast/online_response.py Outdated Show resolved Hide resolved
sdk/python/feast/online_response.py Show resolved Hide resolved
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
@judahrand
Copy link
Member Author

Flakey test.... Seen it flake before.

Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Signed-off-by: Judah Rand <17158624+judahrand@users.noreply.github.com>
Copy link
Collaborator

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

@feast-ci-bot feast-ci-bot merged commit 7d177b6 into feast-dev:master Sep 21, 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