From 2e3a5a0d8836e94b6e7a7495b11438f8fe2d5f85 Mon Sep 17 00:00:00 2001
From: Deepyaman Datta <deepyaman.datta@utexas.edu>
Date: Thu, 2 Nov 2023 09:55:32 -0600
Subject: [PATCH] fix(flink): re-implement `ops.ApproxCountDistinct`

---
 ibis/backends/flink/registry.py         | 3 ++-
 ibis/backends/tests/test_aggregation.py | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ibis/backends/flink/registry.py b/ibis/backends/flink/registry.py
index 19bd95b61544..896ae6c1f82c 100644
--- a/ibis/backends/flink/registry.py
+++ b/ibis/backends/flink/registry.py
@@ -4,7 +4,7 @@
 
 import ibis.common.exceptions as com
 import ibis.expr.operations as ops
-from ibis.backends.base.sql.registry import fixed_arity, helpers, unary
+from ibis.backends.base.sql.registry import aggregate, fixed_arity, helpers, unary
 from ibis.backends.base.sql.registry import (
     operation_registry as base_operation_registry,
 )
@@ -389,6 +389,7 @@ def _timestamp_from_ymdhms(
         ops.Degrees: unary("degrees"),
         ops.Radians: unary("radians"),
         # Unary aggregates
+        ops.ApproxCountDistinct: aggregate.reduction("approx_count_distinct"),
         ops.CountStar: _count_star,
         # String operations
         ops.StringLength: unary("char_length"),
diff --git a/ibis/backends/tests/test_aggregation.py b/ibis/backends/tests/test_aggregation.py
index 8ef6ebb858c8..f02301dd36e3 100644
--- a/ibis/backends/tests/test_aggregation.py
+++ b/ibis/backends/tests/test_aggregation.py
@@ -533,7 +533,6 @@ def mean_and_std(v):
             id="approx_nunique",
             marks=[
                 pytest.mark.notimpl(["polars"], raises=com.OperationNotDefinedError),
-                pytest.mark.notimpl(["flink"], "WIP", raises=Py4JError),
             ],
         ),
         param(