Skip to content

Fix time zone issue with get_historical_features#1475

Merged
feast-ci-bot merged 2 commits into
masterfrom
fix-tz-offline-store
Apr 19, 2021
Merged

Fix time zone issue with get_historical_features#1475
feast-ci-bot merged 2 commits into
masterfrom
fix-tz-offline-store

Conversation

@tsotnet

@tsotnet tsotnet commented Apr 17, 2021

Copy link
Copy Markdown
Collaborator

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>
"customer_id",
]
).reset_index(drop=True),
check_dtype=False,

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

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

@woop

woop commented Apr 19, 2021

Copy link
Copy Markdown
Member

/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.

3 participants