diff --git a/ibis/backends/clickhouse/compiler/values.py b/ibis/backends/clickhouse/compiler/values.py index c28292090aca..0537213d29f7 100644 --- a/ibis/backends/clickhouse/compiler/values.py +++ b/ibis/backends/clickhouse/compiler/values.py @@ -436,6 +436,16 @@ def _truncate(op, *, arg, unit, **_): return converter(arg) +@translate_val.register(ops.TimestampBucket) +def _timestamp_bucket(op, *, arg, interval, offset, **_): + if offset is not None: + raise com.UnsupportedOperationError( + "Timestamp bucket with offset is not supported" + ) + + return F.toStartOfInterval(arg, interval) + + @translate_val.register(ops.DateFromYMD) def _date_from_ymd(op, *, year, month, day, **_): return F.toDate( diff --git a/ibis/backends/tests/test_temporal.py b/ibis/backends/tests/test_temporal.py index 730e712dbdad..f273caae762f 100644 --- a/ibis/backends/tests/test_temporal.py +++ b/ibis/backends/tests/test_temporal.py @@ -2518,7 +2518,6 @@ def test_delta(con, start, end, unit, expected): @pytest.mark.notimpl( [ "bigquery", - "clickhouse", "dask", "datafusion", "flink", @@ -2543,7 +2542,15 @@ def test_delta(con, start, end, unit, expected): @pytest.mark.parametrize( "kws, pd_freq", [ - ({"milliseconds": 50}, "50ms"), + param( + {"milliseconds": 50}, + "50ms", + marks=pytest.mark.notimpl( + ["clickhouse"], + raises=com.UnsupportedOperationError, + reason="clickhouse doesn't support sub-second interval precision", + ), + ), ({"seconds": 2}, "2s"), ({"minutes": 5}, "300s"), ({"hours": 2}, "2h"), @@ -2560,7 +2567,6 @@ def test_timestamp_bucket(backend, kws, pd_freq): @pytest.mark.notimpl( [ "bigquery", - "clickhouse", "dask", "datafusion", "flink",