Skip to content

Commit 11bd3aa

Browse files
Add bigframes.bigquery.rand() function
This change adds `bigframes.bigquery.rand()` which wraps the BigQuery `RAND()` function. It accepts a Series or DataFrame as input to determine the shape and index of the output Series. It includes a warning about non-determinism in the docstring. Additionally, `SqlScalarOp` has been updated to accept an `is_deterministic` argument, which is set to `False` for `rand()`. Tests are added in `tests/unit/bigquery/test_mathematical.py` and `tests/system/small/bigquery/test_mathematical.py`. Ran `nox -s format lint mypy` and confirmed no issues were introduced. Co-authored-by: tswast <247555+tswast@users.noreply.github.com>
1 parent 285394b commit 11bd3aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bigframes/bigquery/_operations/mathematical.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def rand(input_data: Union[series.Series, dataframe.DataFrame]) -> series.Series
2828
2929
.. warning::
3030
This method introduces non-determinism to the expression. Reading the
31-
same column twice may result in different results. This value might
32-
change and not to use this value or any value derived from it as a join
31+
same column twice may result in different results. The value might
32+
change. Do not use this value or any value derived from it as a join
3333
key.
3434
3535
**Examples:**

0 commit comments

Comments
 (0)