Skip to content

Commit

Permalink
fix(dask): implement timestamp-date binary comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Jul 31, 2022
1 parent 4fc666d commit 48d5058
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ibis/backends/dask/execution/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@
register_types_to_dispatcher,
)
from ibis.backends.pandas.core import (
date_types,
integer_types,
numeric_types,
simple_types,
timestamp_types,
)
from ibis.backends.pandas.execution import constants
from ibis.backends.pandas.execution.generic import (
_execute_binary_op_impl,
execute_between,
execute_cast_series_array,
execute_cast_series_generic,
Expand Down Expand Up @@ -314,15 +316,14 @@ def execute_not_scalar_or_series(op, data, **kwargs):
@execute_node.register(ops.Comparison, dd.Series, timestamp_types)
@execute_node.register(ops.Comparison, timestamp_types, dd.Series)
def execute_binary_op(op, left, right, **kwargs):
op_type = type(op)
try:
operation = constants.BINARY_OPERATIONS[op_type]
except KeyError:
raise NotImplementedError(
f'Binary operation {op_type.__name__} not implemented'
)
else:
return operation(left, right)
return _execute_binary_op_impl(op, left, right, **kwargs)


@execute_node.register(ops.Comparison, dd.Series, date_types)
def execute_binary_op_date_right(op, left, right, **kwargs):
return _execute_binary_op_impl(
op, dd.to_datetime(left), pd.to_datetime(right), **kwargs
)


@execute_node.register(ops.Binary, ddgb.SeriesGroupBy, ddgb.SeriesGroupBy)
Expand Down

0 comments on commit 48d5058

Please sign in to comment.