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

Fix time zone issue with get_historical_features #1475

Merged
merged 2 commits into from
Apr 19, 2021

Conversation

tsotnet
Copy link
Collaborator

@tsotnet tsotnet commented Apr 17, 2021

Signed-off-by: Tsotne Tabidze tsotne@tecton.ai

What this PR does / why we need it: There was an issue with FeatureStore.get_historical_features when you pass records with timestamp with non-UTC time zones (pandas merge_asof was throwing an exception). This PR fixes that issue by converting all timestamps in the entity to UTC. If timestamp is tz-naive, we assume it's UTC. If it's tz-aware, we localize to UTC.

I also made significant changes to the tests. First, when generating entities we now generate timestamps in all kinds of different formats. Second, test_historical_retrieval.py:get_expected_training_df function used a very similar logic to the local offline store (based on pandas merge_asof). Meaning that if there are bugs in the local offline store, we replicate them in the test. Instead of adding the identical logic to this test, I rewrote this method to do manual (non-pandas) join. This should give us more confidence in the offline store correctness.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduce a user-facing change?:

Fix time zone issue with get_historical_features

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
@@ -274,6 +286,7 @@ def test_historical_features_from_parquet_sources():
"customer_id",
]
).reset_index(drop=True),
check_dtype=False,
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason for this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There were errors for 32bit vs 64 bit stuff, and didn't think it was important to change. I can look into it if you're concerned though

Signed-off-by: Tsotne Tabidze <tsotne@tecton.ai>
@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tsotnet, woop

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

@woop
Copy link
Member

woop commented Apr 19, 2021

/lgtm

@feast-ci-bot feast-ci-bot merged commit 307f110 into master Apr 19, 2021
@woop woop deleted the fix-tz-offline-store branch May 12, 2021 20:27
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.

None yet

3 participants