ray.data.expressions.ColumnExpr.struct#

property ColumnExpr.struct: _StructNamespace#

Access struct operations for this expression.

Returns:

A _StructNamespace that provides struct-specific operations.

Example

>>> from ray.data.expressions import col
>>> import ray
>>> import pyarrow as pa
>>> ds = ray.data.from_arrow(pa.table({
...     "user": pa.array([
...         {"name": "Alice", "age": 30}
...     ], type=pa.struct([
...         pa.field("name", pa.string()),
...         pa.field("age", pa.int32())
...     ]))
... }))
>>> ds = ds.with_column("age", col("user").struct["age"])