Generates a column of UUID strings.
Each call to uuid() generates a fresh UUID per row. Multiple calls in the same query (e.g. two separate columns) are independent and will produce different values.
Returns:
| Name | Type | Description |
Expression | UUID Expression | An expression that generates UUID values. |
Examples:
| >>> import daft
>>> from daft.functions import uuid
>>> df = daft.from_pydict({"foo": [1, 2, 3]})
>>> df = df.with_column("u1", uuid()).with_column("u2", uuid())
>>> df.schema()["u1"].dtype == daft.DataType.uuid()
>>> df.schema()["u2"].dtype == daft.DataType.uuid()
|
Source code in daft/functions/misc.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 | def uuid() -> Expression:
"""Generates a column of UUID strings.
Each call to `uuid()` generates a fresh UUID per row. Multiple calls in the same query
(e.g. two separate columns) are independent and will produce different values.
Returns:
Expression (UUID Expression): An expression that generates UUID values.
Examples:
>>> import daft
>>> from daft.functions import uuid
>>> df = daft.from_pydict({"foo": [1, 2, 3]})
>>> df = df.with_column("u1", uuid()).with_column("u2", uuid())
>>> df.schema()["u1"].dtype == daft.DataType.uuid()
True
>>> df.schema()["u2"].dtype == daft.DataType.uuid()
True
"""
return Expression._call_builtin_scalar_fn("uuid")
|