diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index 7db999d5aeca..7d6cbb6021a2 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -764,13 +764,13 @@ def __getitem__(self, what): # Projection case return self.select(what) - (what,) = bind(self, what) - if isinstance(what, BooleanValue): + items = tuple(bind(self, what)) + if util.all_of(items, BooleanValue): # TODO(kszucs): this branch should be removed, .filter should be # used instead - return self.filter([what]) + return self.filter(items) else: - return self.select(what) + return self.select(items) def __len__(self): raise com.ExpressionError("Use .count() instead") diff --git a/ibis/tests/expr/test_table.py b/ibis/tests/expr/test_table.py index d3ac796d3d3d..ba639b4fd71c 100644 --- a/ibis/tests/expr/test_table.py +++ b/ibis/tests/expr/test_table.py @@ -99,6 +99,19 @@ def test_getitem_column_select(table): assert isinstance(col, Column) +def test_select_using_selector(table): + expr = table[s.numeric()] + expected = table.select( + table.a, + table.b, + table.c, + table.d, + table.e, + table.f, + ) + assert expr.equals(expected) + + def test_table_tab_completion(): table = ibis.table({"a": "int", "b": "int", "for": "int", "with spaces": "int"}) # Only valid python identifiers in getattr tab completion