Skip to content

Commit

Permalink
refactor(api): remove tuple support in SortKey (#9416)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Jun 21, 2024
1 parent 7878d8c commit 4dff6e2
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions ibis/expr/operations/sortkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
# TODO(kszucs): move the content of this file to generic.py


_is_ascending = {
"asc": True,
"ascending": True,
"desc": False,
"descending": False,
0: False,
1: True,
False: False,
True: True,
}


# TODO(kszucs): consider to limit its shape to Columnar, we could treat random()
# as a columnar operation too
@public
Expand All @@ -36,19 +24,13 @@ class SortKey(Value):
shape = rlz.shape_like("expr")

@classmethod
def __coerce__(cls, value, T=None, S=None):
if isinstance(value, tuple):
key, asc = value
else:
key, asc = value, True

asc = _is_ascending[asc]
def __coerce__(cls, key, T=None, S=None):
key = super().__coerce__(key, T=T, S=S)

if isinstance(key, cls):
return key
else:
return cls(key, asc)
return cls(key)

@property
def name(self) -> str:
Expand Down

0 comments on commit 4dff6e2

Please sign in to comment.