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 <wangfelix98@gmail.com>

* Update go feature server docs

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Address review components

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Fix

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Revert

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Fix

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Update comment

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Fix

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Fix

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* Revert indent

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

* fix comment

Signed-off-by: Kevin Zhang <kzhang@tecton.ai>

Co-authored-by: Felix Wang <wangfelix98@gmail.com>
  • 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.