PR out for adding list constructors to the Express...
# daft-dev
r
PR out for adding list constructors to the Expression and SQL APIs .. shoutout to @Garrett Weaver for the feature request! https://github.com/Eventual-Inc/Daft/pull/3737 Example
Copy code
>>> df = daft.from_pydict({"x": [1, 2, 3], "y": [4, 5, 6]})
>>> df = df.select(daft.list_("x", "y").alias("fwd"), daft.list_("y", "x").alias("rev")).show()
╭─────────────┬─────────────╮
│ fwd         ┆ rev         │
│ ---         ┆ ---         │
│ List[Int64] ┆ List[Int64] │
╞═════════════╪═════════════╡
│ [1, 4]      ┆ [4, 1]      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [2, 5]      ┆ [5, 2]      │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [3, 6]      ┆ [6, 3]      │
╰─────────────┴─────────────╯

(Showing first 3 of 3 rows)

>>> from daft import col, list_

>>> df.select(list_(col("x") + col("y"), col("x") - col("y"))).show()
╭─────────────╮
│ list        │
│ ---         │
│ List[Int64] │
╞═════════════╡
│ [5, -3]     │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [7, -3]     │
├╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ [9, -3]     │
╰─────────────╯

(Showing first 3 of 3 rows)
🙌 2