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

Allow using pandas.StringDtype to support on-demand features with STRING type #2229

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

pyalex
Copy link
Collaborator

@pyalex pyalex commented Jan 20, 2022

Signed-off-by: pyalex moskalenko.alexey@gmail.com

What this PR does / why we need it:

Currently it's impossible to create on demand feature view with feature of type string since type inference doesn't support
pandas.StringDtype and dtype object. This PR adds support for pandas.StringDtype. Now string feature can be defined as following:

    @on_demand_feature_view(
        inputs={"date_request": date_request},
        features=[
            Feature("string_output", ValueType.STRING),
        ],
    )
    def test_view_with_missing_feature(features_df: pd.DataFrame) -> pd.DataFrame:
        data = pd.DataFrame()
        data["string_output"] = features_df["some_date"].astype(pd.StringDtype())
        return data

Also during inference, we now raise ValueError with some details instead of AssertionError, which was confusing.
Which issue(s) this PR fixes:

Fixes #2220

Does this PR introduce a user-facing change?:

Support for pandas.StringDtype during type inference for on demand feature view

Signed-off-by: pyalex <moskalenko.alexey@gmail.com>
@codecov-commenter
Copy link

codecov-commenter commented Jan 20, 2022

Codecov Report

Merging #2229 (176e2a5) into master (428c145) will decrease coverage by 25.06%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #2229       +/-   ##
===========================================
- Coverage   84.94%   59.88%   -25.07%     
===========================================
  Files         105      105               
  Lines        8496     8512       +16     
===========================================
- Hits         7217     5097     -2120     
- Misses       1279     3415     +2136     
Flag Coverage Δ
integrationtests ?
unittests 59.88% <60.00%> (+0.15%) ⬆️

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

Impacted Files Coverage Δ
sdk/python/feast/type_map.py 46.09% <17.64%> (-20.32%) ⬇️
...n/tests/integration/registration/test_inference.py 82.45% <100.00%> (-17.55%) ⬇️
.../integration/online_store/test_online_retrieval.py 17.39% <0.00%> (-82.61%) ⬇️
.../integration/online_store/test_universal_online.py 15.20% <0.00%> (-82.49%) ⬇️
...fline_store/test_universal_historical_retrieval.py 19.18% <0.00%> (-80.82%) ⬇️
sdk/python/tests/utils/online_read_write_test.py 20.68% <0.00%> (-79.32%) ⬇️
...gration/registration/test_feature_service_apply.py 31.25% <0.00%> (-68.75%) ⬇️
sdk/python/feast/infra/online_stores/redis.py 26.97% <0.00%> (-67.11%) ⬇️
sdk/python/tests/data/data_creator.py 34.78% <0.00%> (-65.22%) ⬇️
sdk/python/tests/integration/e2e/test_usage_e2e.py 35.00% <0.00%> (-65.00%) ⬇️
... and 52 more

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 428c145...176e2a5. Read the comment docs.

Copy link
Collaborator

@felixwang9817 felixwang9817 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: felixwang9817, pyalex

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 d7707c1 into feast-dev:master Jan 26, 2022
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.

On demand feature view not supporting objects
6 participants