Skip to content

Commit

Permalink
feat(pyspark): implement ops.Between
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztof-kwitt authored and cpcloud committed Feb 17, 2023
1 parent ae57c36 commit ed83465
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions ibis/backends/pyspark/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ def compile_less_equal(t, op, **kwargs):
return t.translate(op.left, **kwargs) <= t.translate(op.right, **kwargs)


@compiles(ops.Between)
def compile_between(t, op, **kwargs):
arg = t.translate(op.arg, **kwargs)
lower_bound = t.translate(op.lower_bound, **kwargs)
upper_bound = t.translate(op.upper_bound, **kwargs)
return arg.between(lower_bound, upper_bound)


@compiles(ops.Multiply)
def compile_multiply(t, op, **kwargs):
return t.translate(op.left, **kwargs) * t.translate(op.right, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion ibis/backends/tests/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_floating_scalar_parameter(backend, alltypes, df, column, raw_value):
('start_string', 'end_string'),
[('2009-03-01', '2010-07-03'), ('2014-12-01', '2017-01-05')],
)
@pytest.mark.notimpl(["datafusion", "pyspark", "mssql", "trino"])
@pytest.mark.notimpl(["datafusion", "mssql", "trino"])
def test_date_scalar_parameter(backend, alltypes, start_string, end_string):
start, end = ibis.param(dt.date), ibis.param(dt.date)

Expand Down

0 comments on commit ed83465

Please sign in to comment.