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

Add ValueType.NULL #1893

Merged
merged 1 commit into from
Sep 22, 2021
Merged

Add ValueType.NULL #1893

merged 1 commit into from
Sep 22, 2021

Conversation

judahrand
Copy link
Member

@judahrand judahrand commented Sep 21, 2021

Signed-off-by: Judah Rand 17158624+judahrand@users.noreply.github.com

What this PR does / why we need it:
This PR fixes this simple case:

from datetime import datetime, timedelta
from feast import Entity, Feature, FeatureStore, FeatureView, FileSource, ValueType
import numpy as np
import pandas as pd
from pathlib import Path

df = pd.DataFrame(columns=["device_type", "encoding", "datetime"])
df["device_type"] = ["A", "B", "C", "D"]
df["encoding"] = [[0, 1, 0], [1, 0, 0], None, [0, 0, 0]]
df["rank"] = np.array([1, None, 3, 4], dtype=np.float64)
df["datetime"] = pd.to_datetime([datetime.now()] * 4)
device_encodings_path_str = "data/device_encodings.parquet"
device_encodings_path = Path(device_encodings_path_str)
device_encodings_abs_path_str = str(device_encodings_path.absolute())
df.to_parquet(device_encodings_abs_path_str)
device_encodings = FileSource(
    path=device_encodings_abs_path_str, event_timestamp_column="datetime"
)
device_type = Entity("device_type", value_type=ValueType.STRING, description="")
device_encoding_view = FeatureView(
    name="device_encoding",
    entities=["device_type"],
    ttl=timedelta(minutes=60),
    input=device_encodings,
    online=True,
)
fm = FeatureStore(repo_path=".")
fm.apply([device_type, device_encoding_view])
fm.materialize(start_date=datetime(2021, 1, 1), end_date=datetime.now())

res = fm.get_online_features(
    [
        "device_encoding:encoding",
        "device_encoding:rank",
    ],
    entity_rows=df["device_type"].to_frame().to_dict("record"),
).to_df()
print(res)

(Okay, I might have sneaked quite a lot of tidy up in here too...)
Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Fixes issues with NULL values

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

codecov-commenter commented Sep 21, 2021

Codecov Report

Merging #1893 (48cc062) into master (7d177b6) will decrease coverage by 21.66%.
The diff coverage is 64.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1893       +/-   ##
===========================================
- Coverage   83.76%   62.09%   -21.67%     
===========================================
  Files          96       96               
  Lines        7424     7430        +6     
===========================================
- Hits         6219     4614     -1605     
- Misses       1205     2816     +1611     
Flag Coverage Δ
integrationtests ?
unittests 62.09% <64.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
sdk/python/feast/infra/utils/aws_utils.py 31.25% <0.00%> (-51.79%) ⬇️
sdk/python/feast/type_map.py 51.11% <65.00%> (-31.20%) ⬇️
sdk/python/feast/online_response.py 84.90% <66.66%> (-1.89%) ⬇️
sdk/python/feast/value_type.py 75.86% <100.00%> (+0.86%) ⬆️
.../integration/online_store/test_universal_online.py 14.73% <0.00%> (-85.27%) ⬇️
.../integration/online_store/test_online_retrieval.py 17.39% <0.00%> (-82.61%) ⬇️
sdk/python/tests/utils/online_read_write_test.py 18.18% <0.00%> (-81.82%) ⬇️
...fline_store/test_universal_historical_retrieval.py 18.69% <0.00%> (-80.49%) ⬇️
...gration/registration/test_feature_service_apply.py 31.25% <0.00%> (-68.75%) ⬇️
sdk/python/tests/data/data_creator.py 34.78% <0.00%> (-65.22%) ⬇️
... and 48 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 7d177b6...48cc062. Read the comment docs.

@adchia adchia self-assigned this Sep 22, 2021
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 e893e7f into feast-dev:master Sep 22, 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.

4 participants