Skip to content

Commit

Permalink
chore: add snapshot test for exists subquery
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Dec 24, 2023
1 parent 4ccec93 commit fa3f290
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SELECT
t0.key1 AS key1,
t0.key2 AS key2,
t0.value1 AS value1
FROM t1 AS t0
WHERE
EXISTS(
(
SELECT
CAST(1 AS TINYINT) AS "1"
FROM t2 AS t1
WHERE
t0.key1 = t1.key1
)
)
13 changes: 6 additions & 7 deletions ibis/backends/tests/sql/test_select_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,15 +417,14 @@ def test_scalar_subquery_different_table(foo, bar, snapshot):
snapshot.assert_match(to_sql(expr), "out.sql")


# TODO(kszucs): should do snapshot testing instead
# def test_exists_subquery_repr(t1, t2):
# # GH #660
def test_exists_subquery(t1, t2, snapshot):
# GH #660

# cond = t1.key1 == t2.key1
# expr = t1[cond.any()]
# stmt = get_query(expr)
cond = t1.key1 == t2.key1
expr = t1[cond.any()]

# repr(stmt.where[0])
snapshot.assert_match(to_sql(expr), "out.sql")
assert repr(expr)


def test_filter_inside_exists(snapshot):
Expand Down

0 comments on commit fa3f290

Please sign in to comment.