Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 285394b

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 431149c commit 285394b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bigframes/bigquery/_operations/mathematical.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ 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.
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
33+
key.
3234
3335
**Examples:**
3436

0 commit comments

Comments
 (0)