Skip to content

Commit

Permalink
refactor(polars): remove extra backwards compatibility code no longer…
Browse files Browse the repository at this point in the history
… in use after 1.0 upgrade
  • Loading branch information
cpcloud authored and jcrist committed Jul 23, 2024
1 parent ac519b2 commit feb12f4
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,7 @@ def join(op, **kw):
how = "full"

joined = left.join(right, on=on, how=how, coalesce=False)

try:
joined = joined.drop(*on)
except TypeError:
joined = joined.drop(columns=on)

joined = joined.drop(*on)
return joined


Expand Down Expand Up @@ -352,10 +347,7 @@ def asof_join(op, **kw):

assert len(on) == 1
joined = left.join_asof(right, on=on[0], by=by, strategy=direction)
try:
joined = joined.drop(*(on + by))
except TypeError:
joined = joined.drop(columns=on + by)
joined = joined.drop(*on, *by)
return joined


Expand Down Expand Up @@ -537,7 +529,7 @@ def string_unary(op, **kw):
@translate.register(ops.Reverse)
def reverse(op, **kw):
arg = translate(op.arg, **kw)
return arg.map_elements(lambda x: x[::-1])
return arg.str.reverse()


@translate.register(ops.StringSplit)
Expand Down Expand Up @@ -829,10 +821,7 @@ def count_star(op, **kw):
condition = translate(where, **kw)
result = condition.sum()
else:
try:
result = pl.len()
except AttributeError:
result = pl.count()
result = pl.len()
return result.cast(PolarsType.from_ibis(op.dtype))


Expand Down

0 comments on commit feb12f4

Please sign in to comment.