-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG]: sql nested and wildcard (#2937)
closes #2935
- Loading branch information
1 parent
28e72b2
commit 0525bb9
Showing
3 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import daft | ||
|
||
|
||
def test_nested(): | ||
df = daft.from_pydict( | ||
{ | ||
"A": [1, 2, 3, 4], | ||
"B": [1.5, 2.5, 3.5, 4.5], | ||
"C": [True, True, False, False], | ||
"D": [None, None, None, None], | ||
} | ||
) | ||
|
||
actual = daft.sql("SELECT (A + 1) AS try_this FROM df").collect() | ||
expected = df.select((daft.col("A") + 1).alias("try_this")).collect() | ||
|
||
assert actual.to_pydict() == expected.to_pydict() | ||
|
||
actual = daft.sql("SELECT *, (A + 1) AS try_this FROM df").collect() | ||
expected = df.with_column("try_this", df["A"] + 1).collect() | ||
|
||
assert actual.to_pydict() == expected.to_pydict() |