diff --git a/ibis/expr/operations/relations.py b/ibis/expr/operations/relations.py index 1092a1d25c52..104b5d752c34 100644 --- a/ibis/expr/operations/relations.py +++ b/ibis/expr/operations/relations.py @@ -148,7 +148,7 @@ def schema(self): @public class DropColumns(Relation): parent: Relation - columns_to_drop: VarTuple[str] + columns_to_drop: frozenset[str] @attribute def schema(self): diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index 0198f5a5318f..572516c2952b 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -2501,7 +2501,7 @@ def drop(self, *fields: str | Selector) -> Table: # no-op if nothing to be dropped return self - columns_to_drop = tuple( + columns_to_drop = frozenset( map(operator.methodcaller("get_name"), self._fast_bind(*fields)) ) return ops.DropColumns(parent=self, columns_to_drop=columns_to_drop).to_expr() diff --git a/ibis/tests/expr/test_table.py b/ibis/tests/expr/test_table.py index db7c2236ace3..cd2718cd7678 100644 --- a/ibis/tests/expr/test_table.py +++ b/ibis/tests/expr/test_table.py @@ -1886,6 +1886,12 @@ def test_drop(): t.drop("e") +def test_drop_equality(): + t = ibis.table(dict.fromkeys("abcd", "int")) + + assert t.drop("a", "b").equals(t.drop("b", "a")) + + def test_python_table_ambiguous(): with pytest.raises(NotImplementedError): ibis.memtable(