Skip to content

Commit

Permalink
All test cases running again fine!
Browse files Browse the repository at this point in the history
  • Loading branch information
yohplala committed Mar 1, 2024
1 parent 3eb8caa commit 51ba417
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 49 deletions.
18 changes: 9 additions & 9 deletions oups/aggstream/aggstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,19 +1326,19 @@ def agg(
# works same as for bin: that empty snapshots are generated between 2 row groups.
# - test case, test parameter value not in 'streamagg' nor in 'write' signature.
# - un test snap + bin avec deux ou trois chunks dans lesquels il n'y a ni snap, ni bin qui se finissent.
# - bien faire un cas test snapshot ou le 2nd seed chunk démarre sur une nouvelle bin,
# straight away / cal pose des problèmes quand c'est simplement bin,
# alors bin+snapshot, il y a des chances que ça ne marche pas non plus.
# - bien faire un cas test snapshot ou le 2nd seed chunk démarre sur une nouvelle bin:
# straight away / ça pose des problèmes quand c'est simplement bin,
# alors bin+snapshot, il y a des chances que ça ne marche pas non plus.
# - Do a test case to check that if in 'post' an exception is raised for instance,
# then values in class are properly set: segagg_buffer, post_buffer, seed_index_restart,
# and agg_res_buffer and bin_res_buffer are empty lists.
# then values in class are properly set: segagg_buffer, post_buffer, seed_index_restart,
# and agg_res_buffer and bin_res_buffer are empty lists.
# - Test new parameters: 'final_write' and seed check exception
# for seed check exception, check the last '_last_seed_index' has been correctly recorded
# and aggregation results integrate results from last seed chunk.
# for seed check exception, check the last '_last_seed_index' has been correctly recorded
# and aggregation results integrate results from last seed chunk.
# - A test that with a given filter release an empty dataframe.
# - A test with a check function that raises an exception: check that last seed index has been
# that of the last iteration, prior to the exception.
# that of the last iteration, prior to the exception.
# - A test for filter_dataframe
# check when some chunk are empty for a given filter id
# check when some chunk are empty for a given filter id
# - A test with first seed generator like Parquet File, then 1 dataframe each time.
# - Test with different 'ordered_on' values for a key vs seed
3 changes: 1 addition & 2 deletions tests/test_aggstream/test_aggstream_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def get_ref_results(seed_df):
assert rec_res.equals(ref_df)


def test_exception_different_indexes_at_restart(tmp_path):
def test_exception_different_indexes_at_restart(store, seed_path):
# Test exception at restart with 2 different 'seed_index_restart' for 2
# different keys.
# - key 1: time grouper '2T', agg 'first', and 'last',
Expand All @@ -242,7 +242,6 @@ def test_exception_different_indexes_at_restart(tmp_path):
rand_ints.sort()
ts = [start + Timedelta(f"{mn}T") for mn in rand_ints]
seed_df = pDataFrame({ordered_on: ts, "val": rand_ints})
seed_path = os_path.join(tmp_path, "seed")
fp_write(seed_path, seed_df, row_group_offsets=max_row_group_size, file_scheme="hive")
seed = ParquetFile(seed_path).iter_row_groups()
# Streamed aggregation for 'key1'.
Expand Down
12 changes: 6 additions & 6 deletions tests/test_aggstream/test_jcumsegagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
from numpy import ones
from numpy import zeros

from oups.streamagg.jcumsegagg import jcsagg
from oups.streamagg.jcumsegagg import jfirst
from oups.streamagg.jcumsegagg import jlast
from oups.streamagg.jcumsegagg import jmax
from oups.streamagg.jcumsegagg import jmin
from oups.streamagg.jcumsegagg import jsum
from oups.aggstream.jcumsegagg import jcsagg
from oups.aggstream.jcumsegagg import jfirst
from oups.aggstream.jcumsegagg import jlast
from oups.aggstream.jcumsegagg import jmax
from oups.aggstream.jcumsegagg import jmin
from oups.aggstream.jcumsegagg import jsum


INT64 = "int64"
Expand Down
28 changes: 14 additions & 14 deletions tests/test_aggstream/test_segmentby.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
from pandas import date_range
from pandas.core.resample import TimeGrouper

from oups.streamagg.segmentby import DTYPE_DATETIME64
from oups.streamagg.segmentby import DTYPE_INT64
from oups.streamagg.segmentby import KEY_BIN_BY
from oups.streamagg.segmentby import KEY_ON_COLS
from oups.streamagg.segmentby import KEY_ORDERED_ON
from oups.streamagg.segmentby import LEFT
from oups.streamagg.segmentby import NULL_INT64_1D_ARRAY
from oups.streamagg.segmentby import RIGHT
from oups.streamagg.segmentby import _next_chunk_starts
from oups.streamagg.segmentby import by_scale
from oups.streamagg.segmentby import by_x_rows
from oups.streamagg.segmentby import mergesort
from oups.streamagg.segmentby import segmentby
from oups.streamagg.segmentby import setup_segmentby
from oups.aggstream.segmentby import DTYPE_DATETIME64
from oups.aggstream.segmentby import DTYPE_INT64
from oups.aggstream.segmentby import KEY_BIN_BY
from oups.aggstream.segmentby import KEY_ON_COLS
from oups.aggstream.segmentby import KEY_ORDERED_ON
from oups.aggstream.segmentby import LEFT
from oups.aggstream.segmentby import NULL_INT64_1D_ARRAY
from oups.aggstream.segmentby import RIGHT
from oups.aggstream.segmentby import _next_chunk_starts
from oups.aggstream.segmentby import by_scale
from oups.aggstream.segmentby import by_x_rows
from oups.aggstream.segmentby import mergesort
from oups.aggstream.segmentby import segmentby
from oups.aggstream.segmentby import setup_segmentby


# from pandas.testing import assert_frame_equal
Expand Down
36 changes: 18 additions & 18 deletions tests/test_aggstream/test_segmentby_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
from pandas import date_range
from pandas.core.resample import TimeGrouper

from oups.streamagg.segmentby import DTYPE_DATETIME64
from oups.streamagg.segmentby import DTYPE_INT64
from oups.streamagg.segmentby import KEY_BIN
from oups.streamagg.segmentby import KEY_LAST_BIN_END
from oups.streamagg.segmentby import KEY_LAST_BIN_LABEL
from oups.streamagg.segmentby import KEY_LAST_ON_VALUE
from oups.streamagg.segmentby import KEY_RESTART_KEY
from oups.streamagg.segmentby import KEY_SNAP
from oups.streamagg.segmentby import LEFT
from oups.streamagg.segmentby import NULL_INT64_1D_ARRAY
from oups.streamagg.segmentby import RIGHT
from oups.streamagg.segmentby import by_scale
from oups.streamagg.segmentby import by_x_rows
from oups.streamagg.segmentby import segmentby
from oups.streamagg.segmentby import setup_segmentby
from oups.aggstream.segmentby import DTYPE_DATETIME64
from oups.aggstream.segmentby import DTYPE_INT64
from oups.aggstream.segmentby import KEY_BIN
from oups.aggstream.segmentby import KEY_LAST_BIN_END
from oups.aggstream.segmentby import KEY_LAST_BIN_LABEL
from oups.aggstream.segmentby import KEY_LAST_ON_VALUE
from oups.aggstream.segmentby import KEY_RESTART_KEY
from oups.aggstream.segmentby import KEY_SNAP
from oups.aggstream.segmentby import LEFT
from oups.aggstream.segmentby import NULL_INT64_1D_ARRAY
from oups.aggstream.segmentby import RIGHT
from oups.aggstream.segmentby import by_scale
from oups.aggstream.segmentby import by_x_rows
from oups.aggstream.segmentby import segmentby
from oups.aggstream.segmentby import setup_segmentby


# from pandas.testing import assert_frame_equal
Expand Down Expand Up @@ -995,9 +995,9 @@ def by_not_restarting_with_same_bin_label(on, buffer=None):
[None] * 3,
[0] * 3,
[
{KEY_RESTART_KEY: 3, KEY_LAST_BIN_LABEL: 0},
{KEY_RESTART_KEY: 2, KEY_LAST_BIN_LABEL: 4},
{KEY_RESTART_KEY: 1, KEY_LAST_BIN_LABEL: 8},
{KEY_BIN: {KEY_RESTART_KEY: 3, KEY_LAST_BIN_LABEL: 0}, KEY_LAST_BIN_LABEL: 0},
{KEY_BIN: {KEY_RESTART_KEY: 2, KEY_LAST_BIN_LABEL: 4}, KEY_LAST_BIN_LABEL: 4},
{KEY_BIN: {KEY_RESTART_KEY: 1, KEY_LAST_BIN_LABEL: 8}, KEY_LAST_BIN_LABEL: 8},
],
),
(
Expand Down

0 comments on commit 51ba417

Please sign in to comment.