Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/investigate inconsistent partition size in fetching larger datasets #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions dask_snowflake/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,20 @@ def test_execute_params(table, connection_kwargs, client):
)


def test_result_batching(table, connection_kwargs, client):
@pytest.mark.parametrize(
"end_date",
[
pytest.param("2000-01-31", id="one month"),
pytest.param(
"2000-12-31",
id="twelve months",
marks=pytest.mark.xfail(reason="inconsistent partition sizing"),
),
],
)
def test_result_batching_partition_sizes(table, connection_kwargs, end_date, client):
ddf = (
dask.datasets.timeseries(freq="10s", seed=1)
dask.datasets.timeseries(start="2000-01-01", end=end_date, freq="10s", seed=1)
.reset_index(drop=True)
.rename(columns=lambda c: c.upper())
)
Expand All @@ -256,6 +267,16 @@ def test_result_batching(table, connection_kwargs, client):
partition_sizes = ddf_out.memory_usage_per_partition().compute()
assert (partition_sizes < 2 * parse_bytes("2 MiB")).all()


def test_result_batching(table, connection_kwargs, client):
ddf = (
dask.datasets.timeseries(freq="10s", seed=1)
.reset_index(drop=True)
.rename(columns=lambda c: c.upper())
)

to_snowflake(ddf, name=table, connection_kwargs=connection_kwargs)

# Test partition_size logic
ddf_out = read_snowflake(
f"SELECT * FROM {table}",
Expand Down