Skip to content

Commit

Permalink
docs: add callout note for Table.sample
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrist committed Oct 17, 2023
1 parent 8e78dfc commit 51027d9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibis/expr/operations/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class Sample(Relation):

table: Relation
fraction: Annotated[float, Between(0, 1)]
method: Literal["row", "block"] = "row"
method: Literal["row", "block"]
seed: UnionType[int, None] = None

@attribute
Expand Down
14 changes: 14 additions & 0 deletions ibis/expr/types/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,20 @@ def sample(
) -> Table:
"""Sample a fraction of rows from a table.
::: {.callout-note}
## Results may be non-repeatable
Sampling is by definition a random operation. Some backends support
specifying a `seed` for repeatable results, but not all backends
support that option. And some backends (duckdb, for example) do support
specifying a seed but may still not have repeatable results in all
cases.
In all cases, results are backend-specific. An execution against one
backend is unlikely to sample the same rows when executed against a
different backend, even with the same `seed` set.
:::
Parameters
----------
fraction
Expand Down

0 comments on commit 51027d9

Please sign in to comment.