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

chore: Add conversion from ValueTypeProto.Enum to new Feast type system #2489

Merged
merged 2 commits into from
Apr 5, 2022

Conversation

felixwang9817
Copy link
Collaborator

Signed-off-by: Felix Wang wangfelix98@gmail.com

What this PR does / why we need it: #2475 added a new type system but did not include a method to convert from the existing type system enums (ValueTypeProto.Enum) to the new type system. This PR adds that conversion method.

Which issue(s) this PR fixes:

Fixes #

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
@felixwang9817 felixwang9817 requested a review from a team as a code owner April 5, 2022 00:58
@felixwang9817 felixwang9817 requested review from adchia and removed request for a team April 5, 2022 00:58
@felixwang9817 felixwang9817 assigned achals and unassigned woop Apr 5, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 5, 2022

Codecov Report

Merging #2489 (1f47c31) into master (ce35835) will decrease coverage by 0.00%.
The diff coverage is 96.29%.

@@            Coverage Diff             @@
##           master    #2489      +/-   ##
==========================================
- Coverage   84.63%   84.62%   -0.01%     
==========================================
  Files         130      130              
  Lines       10998    11031      +33     
==========================================
+ Hits         9308     9335      +27     
- Misses       1690     1696       +6     
Flag Coverage Δ
integrationtests 74.62% <40.74%> (-0.32%) ⬇️
unittests 58.93% <96.29%> (+0.05%) ⬆️

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

Impacted Files Coverage Δ
sdk/python/feast/types.py 94.23% <92.30%> (-1.33%) ⬇️
sdk/python/tests/unit/test_types.py 100.00% <100.00%> (ø)
...ython/feast/embedded_go/online_features_service.py 95.08% <0.00%> (-1.64%) ⬇️
...hon/feast/infra/offline_stores/snowflake_source.py 88.05% <0.00%> (-0.65%) ⬇️
sdk/python/feast/infra/offline_stores/snowflake.py 91.01% <0.00%> (-0.37%) ⬇️
.../integration/online_store/test_universal_online.py 93.14% <0.00%> (-0.29%) ⬇️
.../feature_repos/universal/data_sources/snowflake.py 100.00% <0.00%> (ø)
sdk/python/feast/data_source.py 68.30% <0.00%> (+0.43%) ⬆️

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 ce35835...1f47c31. Read the comment docs.


class PrimitiveFeastType(Enum):
"""
A PrimitiveFeastType represents a primitive type in Feast.

Note that these values must match the values in ValueTypeProto.Enum.
Copy link
Member

Choose a reason for hiding this comment

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

Add a link to the file? Or path?

return PrimitiveFeastType(value_type)

# Complex types must be constructed. Currently only arrays are supported. Note that
# enum values for arrays are precisely the enum value for the array's base type plus 10.
Copy link
Member

Choose a reason for hiding this comment

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

Where does this 10 come from?

Copy link
Member

Choose a reason for hiding this comment

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

Honestly a map is better here because this is sure to break if we add enums that aren't supported or something. We should have a map, and a test that iterates over all possible enum values and ensures that you get a valid feast type.

Signed-off-by: Felix Wang <wangfelix98@gmail.com>
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, felixwang9817

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:
  • OWNERS [achals,felixwang9817]

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.

5 participants