Skip to content

Commit

Permalink
Remove 1us deduction from deletes in latest
Browse files Browse the repository at this point in the history
  • Loading branch information
satrana42 authored and nikhilgarg28 committed Oct 8, 2024
1 parent f4e5ace commit 99ba59a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/fraud/tests/test_driver_payment_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_min_max_radar_score(client):
assert log_response.status_code == 200, log_response.json()

df = client.get_dataset_df("TransactionsDS")
assert df.shape[0] == 327
assert df.shape[0] == 165


@mock
Expand Down
6 changes: 3 additions & 3 deletions fennel/testing/test_data_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ def test_add_delete_timestamps(client):
assert deleted_rows.shape[0] == 3
assert internal_df.loc[0, FENNEL_DELETE_TIMESTAMP] == pd.Timestamp(
"2021-01-04 00:00:00+0000", tz="UTC"
) - pd.Timedelta("1us")
)
assert internal_df.loc[1, FENNEL_DELETE_TIMESTAMP] == pd.Timestamp(
"2021-01-06 00:00:00+0000", tz="UTC"
) - pd.Timedelta("1us")
)
assert internal_df.loc[3, FENNEL_DELETE_TIMESTAMP] == pd.Timestamp(
"2021-01-05 00:00:00+0000", tz="UTC"
) - pd.Timedelta("1us")
)

client.commit(datasets=[UnkeyedTestDataset], message="Add data")
log(UnkeyedTestDataset, df)
Expand Down
4 changes: 1 addition & 3 deletions fennel/testing/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ def add_deletes(
last_index_for_key[key] = i
continue
# Add the timestamp of the current row as the delete timestamp for the last row
# Subtract 1 microsecond to ensure that the delete timestamp is strictly less than the
# timestamp of the next row
del_ts = row[ts_col] - pd.Timedelta("1us")
del_ts = row[ts_col]
delete_timestamps[last_index] = del_ts
last_index_for_key[key] = i

Expand Down

0 comments on commit 99ba59a

Please sign in to comment.