Skip to content

Commit

Permalink
feat(dask): support Table.sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Oct 17, 2023
1 parent 77215be commit 09a7626
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ibis/backends/dask/execution/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,3 +552,8 @@ def execute_table_array_view(op, _, **kwargs):
# Need to compute dataframe in order to squeeze into a scalar
ddf = execute(op.table)
return ddf.compute().squeeze()


@execute_node.register(ops.Sample, dd.DataFrame, object, object)
def execute_sample(op, data, fraction, seed, **kwargs):
return data.sample(frac=fraction, random_state=seed)
3 changes: 0 additions & 3 deletions ibis/backends/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,6 @@ def test_dynamic_table_slice_with_computed_offset(backend):
@pytest.mark.notimpl(
[
"bigquery",
"dask",
"datafusion",
"druid",
"flink",
Expand Down Expand Up @@ -1560,7 +1559,6 @@ def test_sample(backend):
@pytest.mark.notimpl(
[
"bigquery",
"dask",
"datafusion",
"druid",
"flink",
Expand All @@ -1581,7 +1579,6 @@ def test_sample_memtable(con, backend):
[
"bigquery",
"clickhouse",
"dask",
"datafusion",
"druid",
"flink",
Expand Down

0 comments on commit 09a7626

Please sign in to comment.