Skip to content

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

Merged
feast-ci-bot merged 1 commit into
feast-dev:masterfrom
pyalex:on-demand-string-type
Jan 26, 2022
Merged

feast-ci-bot merged 1 commit into
feast-dev:masterfrom
pyalex:on-demand-string-type

Conversation

@pyalex

@pyalex pyalex commented Jan 20, 2022 •

Copy link
Copy Markdown
Collaborator

Signed-off-by: pyalex [email protected]

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

@codecov-commenter

codecov-commenter commented Jan 20, 2022 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 60.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.99%. Comparing base (428c145) to head (176e2a5).
⚠️ Report is 2342 commits behind head on master.

Files with missing lines Patch % Lines
sdk/python/feast/type_map.py 17.64% 14 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2229      +/-   ##
==========================================
+ Coverage   84.94%   84.99%   +0.05%     
==========================================
  Files         105      105              
  Lines        8496     8512      +16     
==========================================
+ Hits         7217     7235      +18     
+ Misses       1279     1277       -2     
Flag Coverage Δ
integrationtests 72.95% <5.71%> (-0.45%) ⬇️
unittests 59.88% <60.00%> (+0.15%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@felixwang9817 felixwang9817 left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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

Details 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

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