From 95474e681ad8a4f0db726f6a638c837a8b673bf2 Mon Sep 17 00:00:00 2001 From: Deepyaman Datta Date: Tue, 12 Sep 2023 22:39:02 -0600 Subject: [PATCH] feat(flink): implement `ops.FloorDivide` operation --- ibis/backends/flink/registry.py | 8 ++++++++ ibis/backends/tests/test_numeric.py | 1 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ibis/backends/flink/registry.py b/ibis/backends/flink/registry.py index 71923e387ac8..52b5533b6732 100644 --- a/ibis/backends/flink/registry.py +++ b/ibis/backends/flink/registry.py @@ -185,6 +185,12 @@ def _window(translator: ExprTranslator, op: ops.Node) -> str: return result +def _floor_divide(translator: ExprTranslator, op: ops.Node) -> str: + left = translator.translate(op.left) + right = translator.translate(op.right) + return f"FLOOR(({left}) / ({right}))" + + operation_registry.update( { # Unary operations @@ -212,5 +218,7 @@ def _window(translator: ExprTranslator, op: ops.Node) -> str: ops.Where: _filter, ops.TimestampFromUNIX: _timestamp_from_unix, ops.Window: _window, + # Binary operations + ops.FloorDivide: _floor_divide, } ) diff --git a/ibis/backends/tests/test_numeric.py b/ibis/backends/tests/test_numeric.py index b2bebea0720e..f02cd95be3d1 100644 --- a/ibis/backends/tests/test_numeric.py +++ b/ibis/backends/tests/test_numeric.py @@ -1143,7 +1143,6 @@ def test_backend_specific_numerics(backend, con, df, alltypes, expr_fn, expected backend.assert_series_equal(result, expected) -# marks=pytest.mark.notimpl(["datafusion"]), @pytest.mark.parametrize( "op", [