-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT] Add wildcards in column expressions (#2629)
Allows using wildcards in columns to match multiple columns, as well as subfields in structs: `col("*")`, `col("mystruct.*")` Helps address #1965, but does not support partial matches of names. I believe this should be done separately using a different expression like `regexcol()` to avoid column naming conflicts. Examples: ```py >>> df = daft.from_pydict({"a": [1, 2, 3], "b": [4, 5, 6]}) >>> df.select("*").show() ╭───────┬───────╮ │ a ┆ b │ │ --- ┆ --- │ │ Int64 ┆ Int64 │ ╞═══════╪═══════╡ │ 1 ┆ 4 │ ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤ │ 2 ┆ 5 │ ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤ │ 3 ┆ 6 │ ╰───────┴───────╯ >>> df.select(col("*").sqrt()).show() ╭────────────────────┬───────────────────╮ │ a ┆ b │ │ --- ┆ --- │ │ Float64 ┆ Float64 │ ╞════════════════════╪═══════════════════╡ │ 1 ┆ 2 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ 1.4142135623730951 ┆ 2.23606797749979 │ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤ │ 1.7320508075688772 ┆ 2.449489742783178 │ ╰────────────────────┴───────────────────╯ ``` ```py >>> df = daft.from_pydict({"a": [{"b": 1, "c": 4}, {"b": 2, "c": 5}]}) >>> df.select("a.*").show() ╭───────┬───────╮ │ b ┆ c │ │ --- ┆ --- │ │ Int64 ┆ Int64 │ ╞═══════╪═══════╡ │ 1 ┆ 4 │ ├╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌┤ │ 2 ┆ 5 │ ╰───────┴───────╯ ```
- Loading branch information
Showing
13 changed files
with
952 additions
and
290 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.