Skip to content

Commit

Permalink
chore: use the reduction machinery instead of custom rules
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Dec 31, 2024
1 parent e222030 commit d82684e
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions ibis/backends/polars/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,9 @@ def struct_column(op, **kw):
ops.Median: "median",
ops.Min: "min",
ops.Sum: "sum",
ops.BitOr: "bitwise_or",
ops.BitAnd: "bitwise_and",
ops.BitXor: "bitwise_xor",
}


Expand Down Expand Up @@ -1614,21 +1617,3 @@ def visit_StringFind(op, **kw):
end = translate(op.end, **kw) if op.end is not None else None
expr = arg.str.slice(start, end).str.find(_literal_value(op.substr), literal=True)
return pl.when(expr.is_null()).then(-1).otherwise(expr + start)


@translate.register(ops.BitAnd)
def visit_BitAnd(op, **kw):
arg = translate(op.arg, **kw)
return arg.bitwise_and()


@translate.register(ops.BitOr)
def visit_BitOr(op, **kw):
arg = translate(op.arg, **kw)
return arg.bitwise_or()


@translate.register(ops.BitXor)
def visit_BitXor(op, **kw):
arg = translate(op.arg, **kw)
return arg.bitwise_xor()

0 comments on commit d82684e

Please sign in to comment.