Skip to content

Commit

Permalink
fix: Addresses ZeroDivisionError when materializing file source with …
Browse files Browse the repository at this point in the history
…same timestamps (#2551)

* Add docs for Go feature server

Signed-off-by: Felix Wang <[email protected]>

* Update go feature server docs

Signed-off-by: Kevin Zhang <[email protected]>

* Address review components

Signed-off-by: Kevin Zhang <[email protected]>

* Fix

Signed-off-by: Kevin Zhang <[email protected]>

* Revert

Signed-off-by: Kevin Zhang <[email protected]>

* Fix

Signed-off-by: Kevin Zhang <[email protected]>

* Update comment

Signed-off-by: Kevin Zhang <[email protected]>

* Fix

Signed-off-by: Kevin Zhang <[email protected]>

* Fix

Signed-off-by: Kevin Zhang <[email protected]>

* Revert indent

Signed-off-by: Kevin Zhang <[email protected]>

* fix comment

Signed-off-by: Kevin Zhang <[email protected]>

Co-authored-by: Felix Wang <[email protected]>
  • Loading branch information
2 people authored and adchia committed Apr 20, 2022
1 parent 39d3f9d commit 5539c51
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/reference/feature-servers/go-feature-retrieval.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Go Feature Retrieval component currently only supports Redis and Sqlite as o

## Installation

As long as you are running macOS or linux x86 with python version 3.7-3.10, the go component comes pre-compiled when you run install feast.
As long as you are running macOS or linux, on x86, with python version 3.7-3.10, the go component comes pre-compiled when you install feast.

For developers, if you want to build from source, run `make compile-go-lib` to build and compile the go server.

Expand Down
22 changes: 18 additions & 4 deletions sdk/python/feast/infra/offline_stores/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,25 @@ def evaluate_offline_job():
if created_timestamp_column
else [event_timestamp_column]
)
# try-catch block is added to deal with this issue https://github.com/dask/dask/issues/8939.
# TODO(kevjumba): remove try catch when fix is merged upstream in Dask.
try:
if created_timestamp_column:
source_df = source_df.sort_values(by=created_timestamp_column,)

source_df = source_df.sort_values(by=event_timestamp_column)

except ZeroDivisionError:
# Use 1 partition to get around case where everything in timestamp column is the same so the partition algorithm doesn't
# try to divide by zero.
if created_timestamp_column:
source_df = source_df.sort_values(
by=created_timestamp_column, npartitions=1
)

if created_timestamp_column:
source_df = source_df.sort_values(by=created_timestamp_column)

source_df = source_df.sort_values(by=event_timestamp_column)
source_df = source_df.sort_values(
by=event_timestamp_column, npartitions=1
)

source_df = source_df[
(source_df[event_timestamp_column] >= start_date)
Expand Down

0 comments on commit 5539c51

Please sign in to comment.