Skip to content

Commit

Permalink
fix(ir): compute InSubquery.shape property from needle input (#8364)
Browse files Browse the repository at this point in the history
Fixes #8361.
  • Loading branch information
cpcloud committed Feb 15, 2024
1 parent 2750fe5 commit 13d675e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ibis/expr/operations/subqueries.py
Expand Up @@ -53,7 +53,7 @@ class InSubquery(Subquery):
needle: Value

dtype = dt.boolean
shape = ds.columnar
shape = rlz.shape_like("needle")

def __init__(self, rel, needle):
if len(rel.schema) != 1:
Expand Down
10 changes: 10 additions & 0 deletions ibis/tests/expr/test_value_exprs.py
Expand Up @@ -1713,3 +1713,13 @@ def test_deferred_doesnt_convert_callables():
b=t.b.split(",").filter(lambda pp: ~pp.isin(("word1", "word2")))
)
assert expr.equals(expected)


def test_in_subquery_shape():
t = ibis.table([("a", "int64"), ("b", "string")])

expr = t.a.cast("string").isin(t.b)
assert expr.op().shape.is_columnar()

expr = ibis.literal(2).isin(t.a)
assert expr.op().shape.is_scalar()

0 comments on commit 13d675e

Please sign in to comment.