Skip to content

Commit ae1e112

Browse files
authored
fix(drop): ignore order for DropColumns equality (#9677)
1 parent efae2ec commit ae1e112

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

ibis/expr/operations/relations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def schema(self):
148148
@public
149149
class DropColumns(Relation):
150150
parent: Relation
151-
columns_to_drop: VarTuple[str]
151+
columns_to_drop: frozenset[str]
152152

153153
@attribute
154154
def schema(self):

ibis/expr/types/relations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2501,7 +2501,7 @@ def drop(self, *fields: str | Selector) -> Table:
25012501
# no-op if nothing to be dropped
25022502
return self
25032503

2504-
columns_to_drop = tuple(
2504+
columns_to_drop = frozenset(
25052505
map(operator.methodcaller("get_name"), self._fast_bind(*fields))
25062506
)
25072507
return ops.DropColumns(parent=self, columns_to_drop=columns_to_drop).to_expr()

ibis/tests/expr/test_table.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,12 @@ def test_drop():
18861886
t.drop("e")
18871887

18881888

1889+
def test_drop_equality():
1890+
t = ibis.table(dict.fromkeys("abcd", "int"))
1891+
1892+
assert t.drop("a", "b").equals(t.drop("b", "a"))
1893+
1894+
18891895
def test_python_table_ambiguous():
18901896
with pytest.raises(NotImplementedError):
18911897
ibis.memtable(

0 commit comments

Comments
 (0)